Socket
Socket
Sign inDemoInstall

@fp-ts/data

Package Overview
Dependencies
Maintainers
3
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fp-ts/data - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

_mjs/internal/List/sort.mjs

31

Chunk.d.ts
/**
* @since 1.0.0
*/
import type { TypeLambda } from "@fp-ts/core/HKT";
import type { Order } from "@fp-ts/core/typeclass/Order";

@@ -22,6 +23,12 @@ import type { Either } from "@fp-ts/data/Either";

readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly length: number;
}
/**
* @since 1.0.0
* @category type lambdas
*/
export interface ChunkTypeLambda extends TypeLambda {
readonly type: Chunk<this["Target"]>;
}
/**
* Checks if `u` is a `Chunk<unknown>`

@@ -51,3 +58,3 @@ *

*/
export declare const toArray: <A>(self: Chunk<A>) => readonly A[];
export declare const toReadonlyArray: <A>(self: Chunk<A>) => readonly A[];
/**

@@ -87,3 +94,3 @@ * Gets the `n`-th element in the chunk if it exists

*/
export declare const prepend: <A1>(a: A1) => <A>(self: Chunk<A>) => Chunk<A1 | A>;
export declare const prepend: <B>(elem: B) => <A>(self: Chunk<A>) => Chunk<B | A>;
/**

@@ -151,3 +158,3 @@ * Takes the first up to `n` elements from the chunk

*/
export declare const filterMapWithIndex: <A, B>(f: (i: number, a: A) => Option<B>) => (self: Iterable<A>) => Chunk<B>;
export declare const filterMapWithIndex: <A, B>(f: (a: A, i: number) => Option<B>) => (self: Iterable<A>) => Chunk<B>;
/**

@@ -201,4 +208,4 @@ * Transforms all elements of the chunk for as long as the specified function returns some value

*/
export declare function findFirst<A, B extends A>(f: Refinement<A, B>): (self: Chunk<A>) => Option<B>;
export declare function findFirst<A>(f: Predicate<A>): (self: Chunk<A>) => Option<A>;
export declare function findFirst<A, B extends A>(refinement: Refinement<A, B>): (self: Chunk<A>) => Option<B>;
export declare function findFirst<A>(predicate: Predicate<A>): (self: Chunk<A>) => Option<A>;
/**

@@ -297,3 +304,3 @@ * Find the first index for which a predicate holds

*/
export declare const reduceWithIndex: <A, S>(s: S, f: (i: number, s: S, a: A) => S) => (self: Chunk<A>) => S;
export declare const reduceWithIndex: <B, A>(b: B, f: (b: B, a: A, i: number) => B) => (self: Chunk<A>) => B;
/**

@@ -305,3 +312,3 @@ * Folds over the elements in this chunk from the right.

*/
export declare const reduceRight: <A, S>(s: S, f: (a: A, s: S) => S) => (self: Chunk<A>) => S;
export declare const reduceRight: <A, S>(s: S, f: (s: S, a: A) => S) => (self: Chunk<A>) => S;
/**

@@ -313,3 +320,3 @@ * Folds over the elements in this chunk from the right.

*/
export declare const reduceRightWithIndex: <A, S>(s: S, f: (i: number, a: A, s: S) => S) => (self: Chunk<A>) => S;
export declare const reduceRightWithIndex: <B, A>(b: B, f: (b: B, a: A, i: number) => B) => (self: Chunk<A>) => B;
/**

@@ -358,3 +365,3 @@ * Joins the elements together with "sep" in the middle.

*/
export declare const mapWithIndex: <A, B>(f: (i: number, a: A) => B) => (self: Chunk<A>) => Chunk<B>;
export declare const mapWithIndex: <A, B>(f: (a: A, i: number) => B) => (self: Chunk<A>) => Chunk<B>;
/**

@@ -374,4 +381,4 @@ * Statefully maps over the chunk, producing new elements of type `B`.

export declare const partitionWithIndex: {
<C extends A, B extends A, A = C>(refinement: (i: number, a: A) => a is B): (fb: Chunk<C>) => readonly [Chunk<C>, Chunk<B>];
<B extends A, A = B>(predicate: (i: number, a: A) => boolean): (fb: Chunk<B>) => readonly [Chunk<B>, Chunk<B>];
<C extends A, B extends A, A = C>(refinement: (a: A, i: number) => a is B): (fb: Chunk<C>) => readonly [Chunk<C>, Chunk<B>];
<B extends A, A = B>(predicate: (a: A, i: number) => boolean): (fb: Chunk<B>) => readonly [Chunk<B>, Chunk<B>];
};

@@ -378,0 +385,0 @@ /**

@@ -12,3 +12,3 @@ "use strict";

exports.mapAccum = mapAccum;
exports.unfold = exports.toArray = exports.takeWhile = exports.takeRight = exports.take = exports.tail = exports.splitWhere = exports.splitAt = exports.split = exports.sort = exports.some = exports.size = exports.single = exports.separate = exports.reverse = exports.reduceWithIndex = exports.reduceRightWithIndex = exports.reduceRight = exports.reduce = exports.range = exports.prepend = exports.partitionWithIndex = exports.partitionMap = exports.partition = exports.mapWithIndex = void 0;
exports.unfold = exports.toReadonlyArray = exports.takeWhile = exports.takeRight = exports.take = exports.tail = exports.splitWhere = exports.splitAt = exports.split = exports.sort = exports.some = exports.size = exports.single = exports.separate = exports.reverse = exports.reduceWithIndex = exports.reduceRightWithIndex = exports.reduceRight = exports.reduce = exports.range = exports.prepend = exports.partitionWithIndex = exports.partitionMap = exports.partition = exports.mapWithIndex = void 0;
exports.union = union;

@@ -58,4 +58,2 @@ exports.zipWithIndexOffset = exports.zipWithIndex = exports.zipWith = exports.zipAllWith = exports.zipAll = exports.zip = exports.unzip = exports.unsafeLast = exports.unsafeHead = exports.unsafeGet = exports.unsafeFromArray = void 0;

this._A = _ => _;
switch (backing._tag) {

@@ -128,7 +126,7 @@ case "IEmpty":

[Equal.symbolEqual](that) {
return isChunk(that) && Equal.equals(toArray(this), toArray(that));
return isChunk(that) && Equal.equals(toReadonlyArray(this), toReadonlyArray(that));
}
[Equal.symbolHash]() {
return Equal.hash(toArray(this));
return Equal.hash(toReadonlyArray(this));
}

@@ -150,3 +148,3 @@

{
return toArray(this)[Symbol.iterator]();
return toReadonlyArray(this)[Symbol.iterator]();
}

@@ -162,7 +160,2 @@ }

switch (self.backing._tag) {
case "IEmpty":
{
break;
}
case "IArray":

@@ -259,3 +252,3 @@ {

const toArray = self => {
const toReadonlyArray = self => {
switch (self.backing._tag) {

@@ -295,3 +288,3 @@ case "IEmpty":

exports.toArray = toArray;
exports.toReadonlyArray = toReadonlyArray;

@@ -337,13 +330,9 @@ const get = n => self => n >= self.length ? O.none : O.some(unsafeGet(n)(self));

{
if (index < self.backing.start.length) {
if (index < 0 || index >= self.length) {
throw new Error(`Index out of bounds`);
} else if (index < self.backing.start.length) {
return unsafeGet(index)(self.backing.start);
} else {
return self.backing.buffer[index - self.backing.start.length];
}
const k = index - self.backing.start.length;
if (k >= self.backing.buffer.length || k < 0) {
throw new Error(`Index out of bounds`);
}
return self.backing.buffer[k];
}

@@ -353,13 +342,9 @@

{
if (index < self.backing.bufferUsed) {
const k = BufferSize - self.backing.bufferUsed + index;
if (k >= self.backing.buffer.length || k < 0) {
throw new Error(`Index out of bounds`);
}
return self.backing.buffer[k];
if (index < 0 || index >= self.length) {
throw new Error(`Index out of bounds`);
} else if (index < self.backing.bufferUsed) {
return self.backing.buffer[BufferSize - self.backing.bufferUsed + index];
} else {
return unsafeGet(index - self.backing.bufferUsed)(self.backing.end);
}
return unsafeGet(index - self.backing.bufferUsed)(self.backing.end);
}

@@ -421,3 +406,3 @@

start: concat(chunk)(self.backing.start),
buffer: self.backing.buffer,
buffer,
bufferUsed: 1,

@@ -453,3 +438,3 @@ chain: MRef.make(1)

const prepend = a => self => {
const prepend = elem => self => {
switch (self.backing._tag) {

@@ -459,3 +444,3 @@ case "IPrepend":

if (self.backing.bufferUsed < self.backing.buffer.length && MRef.compareAndSet(self.backing.bufferUsed, self.backing.bufferUsed + 1)(self.backing.chain)) {
self.backing.buffer[BufferSize - self.backing.bufferUsed - 1] = a;
self.backing.buffer[BufferSize - self.backing.bufferUsed - 1] = elem;
return new ChunkImpl({

@@ -470,8 +455,8 @@ _tag: "IPrepend",

const buffer = new Array(BufferSize);
buffer[0] = a;
buffer[BufferSize - 1] = elem;
const chunk = take(self.backing.bufferUsed)(unsafeFromArray(self.backing.buffer));
return new ChunkImpl({
_tag: "IPrepend",
end: concat(chunk)(self.backing.end),
buffer: self.backing.buffer,
end: concat(self.backing.end)(chunk),
buffer,
bufferUsed: 1,

@@ -486,3 +471,3 @@ chain: MRef.make(1)

const buffer = new Array(BufferSize);
buffer[BufferSize - 1] = a;
buffer[BufferSize - 1] = elem;
return new ChunkImpl({

@@ -515,7 +500,2 @@ _tag: "IPrepend",

switch (self.backing._tag) {
case "IEmpty":
{
return empty;
}
case "ISlice":

@@ -531,7 +511,2 @@ {

case "ISingleton":
{
return self;
}
default:

@@ -568,7 +543,2 @@ {

switch (self.backing._tag) {
case "IEmpty":
{
return empty;
}
case "ISlice":

@@ -584,11 +554,2 @@ {

case "ISingleton":
{
if (n > 0) {
return empty;
}
return self;
}
default:

@@ -629,3 +590,3 @@ {

return self => {
const arr = toArray(self);
const arr = toReadonlyArray(self);
const len = arr.length;

@@ -765,4 +726,4 @@ let i = 0;

const selfArray = toArray(self);
const thatArray = toArray(that);
const selfArray = toReadonlyArray(self);
const thatArray = toReadonlyArray(that);
return selfArray.every((v, i) => f(v, thatArray[i]));

@@ -838,3 +799,3 @@ };

const elem = a => self => (0, _Function.pipe)(toArray(self), RA.elem(a));
const elem = a => self => (0, _Function.pipe)(toReadonlyArray(self), RA.elem(a));
/**

@@ -884,3 +845,3 @@ * Filter out optional values

const some = f => self => toArray(self).findIndex(v => f(v)) !== -1;
const some = f => self => toReadonlyArray(self).findIndex(v => f(v)) !== -1;
/**

@@ -896,8 +857,8 @@ * Check if a predicate holds true for every `Chunk` member.

const every = f => self => toArray(self).every(v => f(v));
const every = f => self => toReadonlyArray(self).every(v => f(v));
exports.every = every;
function findFirst(f) {
return self => RA.findFirst(f)(toArray(self));
function findFirst(predicate) {
return self => RA.findFirst(predicate)(toReadonlyArray(self));
}

@@ -912,3 +873,3 @@ /**

const findFirstIndex = f => self => RA.findIndex(f)(toArray(self));
const findFirstIndex = f => self => RA.findIndex(f)(toReadonlyArray(self));
/**

@@ -924,3 +885,3 @@ * Find the first index for which a predicate holds

const findLastIndex = f => self => RA.findLastIndex(f)(toArray(self));
const findLastIndex = f => self => RA.findLastIndex(f)(toReadonlyArray(self));

@@ -930,3 +891,3 @@ exports.findLastIndex = findLastIndex;

function findLast(f) {
return self => RA.findLast(f)(toArray(self));
return self => RA.findLast(f)(toReadonlyArray(self));
}

@@ -975,3 +936,3 @@ /**

const forEach = f => self => toArray(self).forEach(f);
const forEach = f => self => toReadonlyArray(self).forEach(f);
/**

@@ -990,3 +951,3 @@ * Groups elements in chunks of up to `n` elements.

let current = [];
toArray(self).forEach(a => {
toReadonlyArray(self).forEach(a => {
current.push(a);

@@ -1029,3 +990,3 @@

const intersection = that => self => (0, _Function.pipe)(toArray(self), RA.intersection(toArray(that)), unsafeFromArray);
const intersection = that => self => (0, _Function.pipe)(toReadonlyArray(self), RA.intersection(toReadonlyArray(that)), unsafeFromArray);
/**

@@ -1063,3 +1024,3 @@ * Determines if the chunk is empty.

const reduce = (s, f) => self => (0, _Function.pipe)(toArray(self), RA.reduce(s, f));
const reduce = (s, f) => self => (0, _Function.pipe)(toReadonlyArray(self), RA.reduce(s, f));
/**

@@ -1075,3 +1036,3 @@ * Folds over the elements in this chunk from the left.

const reduceWithIndex = (s, f) => self => (0, _Function.pipe)(toArray(self), RA.reduceWithIndex(s, f));
const reduceWithIndex = (b, f) => self => (0, _Function.pipe)(toReadonlyArray(self), RA.reduceWithIndex(b, f));
/**

@@ -1087,3 +1048,3 @@ * Folds over the elements in this chunk from the right.

const reduceRight = (s, f) => self => (0, _Function.pipe)(toArray(self), RA.reduceRight(s, (s, a) => f(a, s)));
const reduceRight = (s, f) => self => (0, _Function.pipe)(toReadonlyArray(self), RA.reduceRight(s, (s, a) => f(s, a)));
/**

@@ -1099,3 +1060,3 @@ * Folds over the elements in this chunk from the right.

const reduceRightWithIndex = (s, f) => self => (0, _Function.pipe)(toArray(self), RA.reduceRightWithIndex(s, f));
const reduceRightWithIndex = (b, f) => self => (0, _Function.pipe)(toReadonlyArray(self), RA.reduceRightWithIndex(b, f));
/**

@@ -1157,3 +1118,3 @@ * Joins the elements together with "sep" in the middle.

const map = f => self => unsafeFromArray(RA.map(f)(toArray(self)));
const map = f => self => unsafeFromArray(RA.map(f)(toReadonlyArray(self)));
/**

@@ -1169,3 +1130,3 @@ * Returns an effect whose success is mapped by the specified f function.

const mapWithIndex = f => self => unsafeFromArray((0, _Function.pipe)(toArray(self), RA.mapWithIndex((a, i) => f(i, a))));
const mapWithIndex = f => self => unsafeFromArray((0, _Function.pipe)(toReadonlyArray(self), RA.mapWithIndex(f)));
/**

@@ -1186,3 +1147,3 @@ * Statefully maps over the chunk, producing new elements of type `B`.

for (const a of toArray(self)) {
for (const a of toReadonlyArray(self)) {
const r = f(s1, a);

@@ -1205,3 +1166,3 @@ s1 = r[0];

const partitionWithIndex = f => {
return self => (0, _Function.pipe)(toArray(self), RA.partitionWithIndex(f), ([l, r]) => [unsafeFromArray(l), unsafeFromArray(r)]);
return self => (0, _Function.pipe)(toReadonlyArray(self), RA.partitionWithIndex(f), ([l, r]) => [unsafeFromArray(l), unsafeFromArray(r)]);
};

@@ -1218,3 +1179,3 @@ /**

const partition = predicate => fb => (0, _Function.pipe)(toArray(fb), RA.partition(predicate), ([l, r]) => [unsafeFromArray(l), unsafeFromArray(r)]);
const partition = predicate => fb => (0, _Function.pipe)(toReadonlyArray(fb), RA.partition(predicate), ([l, r]) => [unsafeFromArray(l), unsafeFromArray(r)]);
/**

@@ -1230,3 +1191,3 @@ * Partitions the elements of this chunk into two chunks using f.

const partitionMap = f => fa => (0, _Function.pipe)(fa, toArray, RA.partitionMap(f), ([l, r]) => [unsafeFromArray(l), unsafeFromArray(r)]);
const partitionMap = f => fa => (0, _Function.pipe)(fa, toReadonlyArray, RA.partitionMap(f), ([l, r]) => [unsafeFromArray(l), unsafeFromArray(r)]);
/**

@@ -1242,3 +1203,3 @@ * Partitions the elements of this chunk into two chunks.

const separate = fa => (0, _Function.pipe)(fa, toArray, RA.separate, ([l, r]) => [unsafeFromArray(l), unsafeFromArray(r)]);
const separate = fa => (0, _Function.pipe)(fa, toReadonlyArray, RA.separate, ([l, r]) => [unsafeFromArray(l), unsafeFromArray(r)]);
/**

@@ -1273,3 +1234,3 @@ * Build a chunk with an integer range with both min/max included.

const reverse = self => unsafeFromArray(RA.reverse(toArray(self)));
const reverse = self => unsafeFromArray(RA.reverse(toReadonlyArray(self)));
/**

@@ -1310,3 +1271,3 @@ * Creates a Chunk of a single element

const sort = O => as => (0, _Function.pipe)(toArray(as), RA.sort(O), unsafeFromArray);
const sort = O => as => (0, _Function.pipe)(toReadonlyArray(as), RA.sort(O), unsafeFromArray);
/**

@@ -1341,3 +1302,3 @@ * Returns two splits of this chunk at the specified index.

let chunk = [];
toArray(self).forEach(a => {
toReadonlyArray(self).forEach(a => {
chunk.push(a);

@@ -1372,3 +1333,3 @@

for (const a of toArray(self)) {
for (const a of toReadonlyArray(self)) {
if (f(a)) {

@@ -1418,3 +1379,3 @@ break;

for (const a of toArray(self)) {
for (const a of toReadonlyArray(self)) {
if (f(a)) {

@@ -1468,3 +1429,3 @@ res.push(a);

function union(that) {
return self => unsafeFromArray(RA.union(toArray(that))(toArray(self)));
return self => unsafeFromArray(RA.union(toReadonlyArray(that))(toReadonlyArray(self)));
}

@@ -1479,3 +1440,3 @@ /**

const dedupe = self => unsafeFromArray(RA.uniq(toArray(self)));
const dedupe = self => unsafeFromArray(RA.uniq(toReadonlyArray(self)));
/**

@@ -1518,3 +1479,3 @@ * Returns the first element of this chunk.

const fb = [];
toArray(as).forEach(([a, b]) => {
toReadonlyArray(as).forEach(([a, b]) => {
fa.push(a);

@@ -1547,4 +1508,4 @@ fb.push(b);

const zipWith = (that, f) => self => {
const selfA = toArray(self);
const thatA = toArray(that);
const selfA = toReadonlyArray(self);
const thatA = toReadonlyArray(that);
const len = Math.min(selfA.length, thatA.length);

@@ -1594,4 +1555,4 @@ const res = new Array(len);

const leftarr = toArray(self);
const rightArr = toArray(that);
const leftarr = toReadonlyArray(self);
const rightArr = toReadonlyArray(that);
let i = 0;

@@ -1598,0 +1559,0 @@ let j = 0;

@@ -667,11 +667,11 @@ /**

/**
* @category instances
* @category traversing
* @since 1.0.0
*/
export declare const Traversable: traversable.Traversable<EitherTypeLambda>;
export declare const sequence: <F extends TypeLambda>(F: applicative.Applicative<F>) => <E, FR, FO, FE, A>(fa: Either<E, Kind<F, FR, FO, FE, A>>) => Kind<F, FR, FO, FE, Either<E, A>>;
/**
* @category traversing
* @category instances
* @since 1.0.0
*/
export declare const sequence: <F extends TypeLambda>(F: applicative.Applicative<F>) => <E, FR, FO, FE, A>(fa: Either<E, Kind<F, FR, FO, FE, A>>) => Kind<F, FR, FO, FE, Either<E, A>>;
export declare const Traversable: traversable.Traversable<EitherTypeLambda>;
/**

@@ -678,0 +678,0 @@ * @category traversing

@@ -529,4 +529,3 @@ "use strict";

const Foldable = {
reduce,
reduceRight
reduce
};

@@ -931,3 +930,3 @@ /**

/**
* @category instances
* @category traversing
* @since 1.0.0

@@ -938,12 +937,13 @@ */

exports.traverse = traverse;
const Traversable = {
traverse
};
const sequence = /*#__PURE__*/traversable.sequence(traverse);
/**
* @category traversing
* @category instances
* @since 1.0.0
*/
exports.Traversable = Traversable;
const sequence = /*#__PURE__*/traversable.sequence(Traversable);
exports.sequence = sequence;
const Traversable = {
traverse,
sequence
};
/**

@@ -954,3 +954,3 @@ * @category traversing

exports.sequence = sequence;
exports.Traversable = Traversable;
const traverseTap = /*#__PURE__*/traversable.traverseTap(Traversable);

@@ -957,0 +957,0 @@ /**

@@ -22,4 +22,2 @@ /**

readonly _id: TypeId;
readonly _Key: (_: never) => Key;
readonly _Value: (_: never) => Value;
}

@@ -240,3 +238,3 @@ /**

*/
export declare const mapWithIndex: <K, V, A>(f: (key: K, value: V) => A) => (self: HashMap<K, V>) => HashMap<K, A>;
export declare const mapWithIndex: <A, K, B>(f: (a: A, k: K) => B) => (self: HashMap<K, A>) => HashMap<K, B>;
/**

@@ -259,3 +257,3 @@ * Chains over the values of the `HashMap` using the specified function.

*/
export declare const flatMapWithIndex: <K, A, B>(f: (key: K, value: A) => HashMap<K, B>) => (self: HashMap<K, A>) => HashMap<K, B>;
export declare const flatMapWithIndex: <A, K, B>(f: (a: A, k: K) => HashMap<K, B>) => (self: HashMap<K, A>) => HashMap<K, B>;
/**

@@ -274,3 +272,3 @@ * Applies the specified function to the values of the `HashMap`.

*/
export declare const forEachWithIndex: <K, V>(f: (key: K, value: V) => void) => (self: HashMap<K, V>) => void;
export declare const forEachWithIndex: <A, K>(f: (a: A, k: K) => void) => (self: HashMap<K, A>) => void;
/**

@@ -289,3 +287,3 @@ * Reduces the specified state over the values of the `HashMap`.

*/
export declare const reduceWithIndex: <K, V, Z>(zero: Z, f: (accumulator: Z, key: K, value: V) => Z) => (self: HashMap<K, V>) => Z;
export declare const reduceWithIndex: <B, A, K>(b: B, f: (b: B, a: A, k: K) => B) => (self: HashMap<K, A>) => B;
/**

@@ -308,4 +306,4 @@ * Filters entries out of a `HashMap` using the specified predicate.

export declare const filterWithIndex: {
<K, A, B extends A>(f: (k: K, a: A) => a is B): (self: HashMap<K, A>) => HashMap<K, B>;
<K, A>(f: (k: K, a: A) => boolean): (self: HashMap<K, A>) => HashMap<K, A>;
<A, B extends A, K>(f: (a: A, k: K) => a is B): (self: HashMap<K, A>) => HashMap<K, B>;
<A, K>(f: (a: A, k: K) => boolean): (self: HashMap<K, A>) => HashMap<K, A>;
};

@@ -334,4 +332,4 @@ /**

*/
export declare const filterMapWithIndex: <K, A, B>(f: (key: K, value: A) => Option<B>) => (self: HashMap<K, A>) => HashMap<K, B>;
export declare const filterMapWithIndex: <A, K, B>(f: (a: A, k: K) => Option<B>) => (self: HashMap<K, A>) => HashMap<K, B>;
export {};
//# sourceMappingURL=HashMap.d.ts.map

@@ -19,3 +19,2 @@ /**

readonly _id: TypeId;
readonly _A: (_: never) => A;
}

@@ -22,0 +21,0 @@ /**

@@ -331,11 +331,11 @@ /**

/**
* @category instances
* @category traversing
* @since 1.0.0
*/
export declare const Traversable: traversable.Traversable<IdentityTypeLambda>;
export declare const sequence: <F extends TypeLambda>(F: applicative.Applicative<F>) => <R, O, E, A>(fas: Identity<Kind<F, R, O, E, A>>) => Kind<F, R, O, E, Identity<A>>;
/**
* @category traversing
* @category instances
* @since 1.0.0
*/
export declare const sequence: <F extends TypeLambda>(F: applicative.Applicative<F>) => <R, O, E, A>(fas: Identity<Kind<F, R, O, E, A>>) => Kind<F, R, O, E, Identity<A>>;
export declare const Traversable: traversable.Traversable<IdentityTypeLambda>;
/**

@@ -342,0 +342,0 @@ * @category traversing

@@ -424,4 +424,3 @@ "use strict";

const Foldable = {
reduce,
reduceRight
reduce
};

@@ -479,3 +478,3 @@ /**

/**
* @category instances
* @category traversing
* @since 1.0.0

@@ -486,12 +485,13 @@ */

exports.traverse = traverse;
const Traversable = {
traverse
};
const sequence = /*#__PURE__*/traversable.sequence(traverse);
/**
* @category traversing
* @category instances
* @since 1.0.0
*/
exports.Traversable = Traversable;
const sequence = /*#__PURE__*/traversable.sequence(Traversable);
exports.sequence = sequence;
const Traversable = {
traverse,
sequence
};
/**

@@ -502,5 +502,5 @@ * @category traversing

exports.sequence = sequence;
exports.Traversable = Traversable;
const traverseTap = /*#__PURE__*/traversable.traverseTap(Traversable);
exports.traverseTap = traverseTap;
//# sourceMappingURL=Identity.js.map

@@ -29,3 +29,2 @@ /**

import * as mutableRef from "@fp-ts/data/mutable/MutableRef";
import * as nonEmptyReadonlyArray from "@fp-ts/data/NonEmptyReadonlyArray";
import * as number from "@fp-ts/data/Number";

@@ -150,6 +149,2 @@ import * as option from "@fp-ts/data/Option";

*/
nonEmptyReadonlyArray,
/**
* @since 1.0.0
*/
number,

@@ -156,0 +151,0 @@ /**

@@ -6,3 +6,3 @@ "use strict";

});
exports.weakIterableMap = exports.string = exports.sortedSet = exports.sortedMap = exports.safeEval = exports.refinement = exports.redBlackTree = exports.readonlyArray = exports.random = exports.queue = exports.predicate = exports.ordering = exports.orPatch = exports.option = exports.number = exports.nonEmptyReadonlyArray = exports.mutableRef = exports.mutableQueue = exports.mutableListBuilder = exports.mutableList = exports.mutableHashSet = exports.mutableHashMap = exports.list = exports.identity = exports.hashSetPatch = exports.hashSet = exports.hashMapPatch = exports.hashMap = exports.function = exports.fromOption = exports.equal = exports.endomorphism = exports.either = exports.duration = exports.differ = exports.contextPatch = exports.context = exports.const_ = exports.chunkPatch = exports.chunk = exports.boolean = void 0;
exports.weakIterableMap = exports.string = exports.sortedSet = exports.sortedMap = exports.safeEval = exports.refinement = exports.redBlackTree = exports.readonlyArray = exports.random = exports.queue = exports.predicate = exports.ordering = exports.orPatch = exports.option = exports.number = exports.mutableRef = exports.mutableQueue = exports.mutableListBuilder = exports.mutableList = exports.mutableHashSet = exports.mutableHashMap = exports.list = exports.identity = exports.hashSetPatch = exports.hashSet = exports.hashMapPatch = exports.hashMap = exports.function = exports.fromOption = exports.equal = exports.endomorphism = exports.either = exports.duration = exports.differ = exports.contextPatch = exports.context = exports.const_ = exports.chunkPatch = exports.chunk = exports.boolean = void 0;

@@ -109,6 +109,2 @@ var boolean = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Boolean"));

var nonEmptyReadonlyArray = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/NonEmptyReadonlyArray"));
exports.nonEmptyReadonlyArray = nonEmptyReadonlyArray;
var number = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Number"));

@@ -115,0 +111,0 @@

@@ -165,3 +165,3 @@ "use strict";

{
const array = C.toArray(chunk);
const array = C.toReadonlyArray(chunk);
chunk = C.unsafeFromArray(array.slice(head.from, head.until));

@@ -174,3 +174,3 @@ patches = tail;

{
const array = C.toArray(chunk);
const array = C.toReadonlyArray(chunk);
array[head.index] = differ.patch(head.patch, array[head.index]);

@@ -177,0 +177,0 @@ chunk = C.unsafeFromArray(array);

@@ -101,3 +101,3 @@ "use strict";

function diff(oldValue, newValue, differ) {
const [removed, patch] = HashMap.reduceWithIndex([oldValue, empty()], ([map, patch], key, newValue) => {
const [removed, patch] = HashMap.reduceWithIndex([oldValue, empty()], ([map, patch], newValue, key) => {
const option = HashMap.get(key)(map);

@@ -123,3 +123,3 @@

})(newValue);
return HashMap.reduceWithIndex(patch, (patch, key, _) => combine(new Remove(key))(patch))(removed);
return HashMap.reduceWithIndex(patch, (patch, _, key) => combine(new Remove(key))(patch))(removed);
}

@@ -126,0 +126,0 @@ /** @internal */

@@ -10,5 +10,5 @@ import type * as HM from "@fp-ts/data/HashMap";

*/
export declare function mapWithIndex<K, V, A>(f: (key: K, value: V) => A): (self: HM.HashMap<K, V>) => HM.HashMap<K, A>;
export declare function mapWithIndex<A, V, K>(f: (value: V, key: K) => A): (self: HM.HashMap<K, V>) => HM.HashMap<K, A>;
export declare function filter<A>(f: Predicate<A>): <K>(self: HM.HashMap<K, A>) => HM.HashMap<K, A>;
export declare function filterWithIndex<K, A>(f: (k: K, a: A) => boolean): (self: HM.HashMap<K, A>) => HM.HashMap<K, A>;
export declare function filterWithIndex<K, A>(f: (a: A, k: K) => boolean): (self: HM.HashMap<K, A>) => HM.HashMap<K, A>;
//# sourceMappingURL=HashMap.d.ts.map

@@ -63,9 +63,5 @@ "use strict";

const HashMapTypeId = /*#__PURE__*/Symbol.for("@fp-ts/data/HashMap");
exports.HashMapTypeId = HashMapTypeId;
function variance(_) {
return _;
}
/** @internal */
exports.HashMapTypeId = HashMapTypeId;

@@ -79,4 +75,2 @@ class HashMapImpl {

this._id = HashMapTypeId;
this._Key = variance;
this._Value = variance;
}

@@ -425,3 +419,3 @@

const result = beginMutation(self);
forEachWithIndex((k, v) => {
forEachWithIndex((v, k) => {
set(k, v)(result);

@@ -457,3 +451,3 @@ })(that);

return self => {
return mapWithIndex((_, value) => f(value))(self);
return mapWithIndex(f)(self);
};

@@ -471,3 +465,3 @@ }

return self => {
return reduceWithIndex(empty(), (map, key, value) => set(key, f(key, value))(map))(self);
return reduceWithIndex(empty(), (map, value, key) => set(key, f(value, key))(map))(self);
};

@@ -480,3 +474,3 @@ }

return self => {
return (0, _Function.pipe)(self, flatMapWithIndex((_, a) => f(a)));
return (0, _Function.pipe)(self, flatMapWithIndex(f));
};

@@ -489,3 +483,3 @@ }

return self => {
return (0, _Function.pipe)(self, reduceWithIndex(empty(), (zero, key, value) => (0, _Function.pipe)(zero, mutate(map => (0, _Function.pipe)(f(key, value), forEachWithIndex((key, value) => {
return (0, _Function.pipe)(self, reduceWithIndex(empty(), (zero, value, key) => (0, _Function.pipe)(zero, mutate(map => (0, _Function.pipe)(f(value, key), forEachWithIndex((value, key) => {
(0, _Function.pipe)(map, set(key, value));

@@ -500,3 +494,3 @@ }))))));

return self => {
return (0, _Function.pipe)(self, forEachWithIndex((_, value) => f(value)));
return (0, _Function.pipe)(self, forEachWithIndex(f));
};

@@ -509,3 +503,3 @@ }

return self => {
return (0, _Function.pipe)(self, reduceWithIndex(undefined, (_, key, value) => f(key, value)));
return (0, _Function.pipe)(self, reduceWithIndex(undefined, (_, value, key) => f(value, key)));
};

@@ -518,3 +512,3 @@ }

return self => {
return reduceWithIndex(z, (z, _, v) => f(z, v))(self);
return reduceWithIndex(z, (z, v, _) => f(z, v))(self);
};

@@ -530,3 +524,3 @@ }

if (root._tag === "LeafNode") {
return Option.isSome(root.value) ? f(zero, root.key, root.value.value) : zero;
return Option.isSome(root.value) ? f(zero, root.value.value, root.key) : zero;
}

@@ -548,3 +542,3 @@

if (Option.isSome(child.value)) {
zero = f(zero, child.key, child.value.value);
zero = f(zero, child.value.value, child.key);
}

@@ -562,3 +556,3 @@ } else toVisit.push(child.children);

return self => {
return (0, _Function.pipe)(self, filterWithIndex((_, a) => f(a)));
return (0, _Function.pipe)(self, filterWithIndex(f));
};

@@ -571,3 +565,3 @@ }

for (const [k, a] of self) {
if (f(k, a)) {
if (f(a, k)) {
(0, _Function.pipe)(map, set(k, a));

@@ -590,3 +584,3 @@ }

return self => {
return (0, _Function.pipe)(self, filterMapWithIndex((_, a) => f(a)));
return (0, _Function.pipe)(self, filterMapWithIndex(f));
};

@@ -601,3 +595,3 @@ }

for (const [k, a] of self) {
const option = f(k, a);
const option = f(a, k);

@@ -604,0 +598,0 @@ if (Option.isSome(option)) {

@@ -43,9 +43,5 @@ "use strict";

const HashSetTypeId = /*#__PURE__*/Symbol.for("@fp-ts/data/HashSet");
exports.HashSetTypeId = HashSetTypeId;
function variance(_) {
return _;
}
/** @internal */
exports.HashSetTypeId = HashSetTypeId;

@@ -56,3 +52,2 @@ class HashSetImpl {

this._id = HashSetTypeId;
this._A = variance;
}

@@ -294,3 +289,3 @@

return self => {
HM.forEachWithIndex(k => {
HM.forEachWithIndex((_, k) => {
f(k);

@@ -305,3 +300,3 @@ })(self._keyMap);

return self => {
return HM.reduceWithIndex(zero, (z, a) => f(z, a))(self._keyMap);
return HM.reduceWithIndex(zero, (z, _, a) => f(z, a))(self._keyMap);
};

@@ -308,0 +303,0 @@ }

@@ -6,5 +6,6 @@ "use strict";

});
exports._Nil = exports.NilImpl = exports.ListTypeId = exports.ConsImpl = void 0;
exports._Nil = exports.NilImpl = exports.ListTypeId = exports.Invariant = exports.Covariant = exports.ConsImpl = void 0;
exports.all = all;
exports.any = any;
exports.compact = void 0;
exports.concat = concat;

@@ -16,2 +17,3 @@ exports.cons = cons;

exports.filter = filter;
exports.filterMap = void 0;
exports.find = find;

@@ -22,2 +24,3 @@ exports.flatMap = flatMap;

exports.head = head;
exports.imap = void 0;
exports.isCons = isCons;

@@ -36,3 +39,5 @@ exports.isList = isList;

exports.prependAll = prependAll;
exports.productMany = exports.productAll = exports.product = void 0;
exports.reduce = reduce;
exports.reduceRight = void 0;
exports.reverse = reverse;

@@ -43,2 +48,3 @@ exports.reversePrependAll = reversePrependAll;

exports.take = take;
exports.traverse = void 0;
exports.unsafeHead = unsafeHead;

@@ -48,10 +54,16 @@ exports.unsafeLast = unsafeLast;

var covariant = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Covariant"));
var nonEmptyProduct = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/NonEmptyProduct"));
var E = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Either"));
var DE = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Equal"));
var _Function = /*#__PURE__*/require("@fp-ts/data/Function");
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/internal/Common"));
var O = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Option"));
var DE = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Equal"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -61,13 +73,2 @@

/*
* This file is ported from
*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc.
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*/
/** @internal */

@@ -84,5 +85,2 @@ const ListTypeId = /*#__PURE__*/Symbol.for("@fp-ts/data/List");

this._tag = "Cons";
this._A = _ => _;
this._id = ListTypeId;

@@ -145,5 +143,2 @@ }

this._tag = "Nil";
this._A = _ => _;
this._id = ListTypeId;

@@ -316,3 +311,3 @@ }

if (n <= 0) {
return self;
return nil();
}

@@ -325,10 +320,10 @@

let these = make(unsafeHead(self));
let i = 0;
let current = unsafeTail(self);
while (!isNil(these) && i < n) {
these = (0, _Function.pipe)(these, prependAll(make(unsafeHead(self))));
i += 1;
for (let i = 1; i < n; i++) {
these = new ConsImpl(unsafeHead(current), these);
current = unsafeTail(current);
}
return these;
return reverse(these);
};

@@ -410,8 +405,2 @@ }

function filter(p) {
return self => filterCommon_(self, p, false);
}
/** @internal */
function noneIn(l, p, isFlipped) {

@@ -656,2 +645,128 @@ /* eslint-disable no-constant-condition */

function prepend(elem) {
return self => cons(elem, self);
}
/** @internal */
function reverse(self) {
let result = empty();
let these = self;
while (!isNil(these)) {
result = (0, _Function.pipe)(result, prepend(these.head));
these = these.tail;
}
return result;
}
/** @internal */
function splitAt(n) {
return self => [take(n)(self), drop(n)(self)];
}
/** @internal */
function tail(self) {
return isNil(self) ? O.none : O.some(self.tail);
}
/** @internal */
const of = a => cons(a, nil());
/** @internal */
exports.of = of;
const imap = /*#__PURE__*/covariant.imap(map);
/** @internal */
exports.imap = imap;
const Invariant = {
imap
};
/** @internal */
exports.Invariant = Invariant;
const Covariant = { ...Invariant,
map
};
/** @internal */
exports.Covariant = Covariant;
const product = that => self => {
const out = [];
for (const a of self) {
for (const b of that) {
out.push([a, b]);
}
}
return from(out);
};
/** @internal */
exports.product = product;
const productMany = /*#__PURE__*/nonEmptyProduct.productMany(Covariant, product);
/** @internal */
exports.productMany = productMany;
const productAll = collection => {
const as = internal.fromIterable(collection);
return internal.isNonEmpty(as) ? productMany(internal.tail(as))(internal.head(as)) : nil();
};
/** @internal */
exports.productAll = productAll;
const reduceRight = (b, f) => self => reduce([], (acc, a) => {
acc.push(a);
return acc;
})(self).reduceRight(f, b);
/** @internal */
exports.reduceRight = reduceRight;
const filterMap = f => self => {
const bs = [];
for (const a of self) {
const oa = f(a);
if (O.isSome(oa)) {
bs.push(oa.value);
}
}
return from(bs);
};
/** @internal */
exports.filterMap = filterMap;
const compact = /*#__PURE__*/filterMap(_Function.identity);
/** @internal */
exports.compact = compact;
const traverse = F => f => self => (0, _Function.pipe)(self, map(f), F.productAll, F.map(from));
/** @internal */
exports.traverse = traverse;
function filter(p) {
return self => filterCommon_(self, p, false);
}
/** @internal */
function partition(f) {

@@ -694,40 +809,2 @@ return self => {

}
/** @internal */
function prepend(elem) {
return self => cons(elem, self);
}
/** @internal */
function reverse(self) {
let result = empty();
let these = self;
while (!isNil(these)) {
result = (0, _Function.pipe)(result, prepend(these.head));
these = these.tail;
}
return result;
}
/** @internal */
function splitAt(n) {
return self => [take(n)(self), drop(n)(self)];
}
/** @internal */
function tail(self) {
return isNil(self) ? O.none : O.some(self.tail);
}
/** @internal */
const of = a => cons(a, nil());
exports.of = of;
//# sourceMappingURL=List.js.map

@@ -64,4 +64,2 @@ "use strict";

this._id = QueueTypeId;
this._A = _ => _;
}

@@ -68,0 +66,0 @@

@@ -10,4 +10,2 @@ import type * as Order from "@fp-ts/core/typeclass/Order";

readonly _id: RBT.TypeId;
readonly _Key: (_: never) => K;
readonly _Value: (_: never) => V;
constructor(_ord: Order.Order<K>, _root: Node.Node<K, V> | undefined);

@@ -14,0 +12,0 @@ [Equal.symbolHash](): number;

@@ -58,6 +58,2 @@ "use strict";

function variance(_) {
return _;
}
class RedBlackTreeImpl {

@@ -68,4 +64,2 @@ constructor(_ord, _root) {

this._id = RedBlackTreeTypeId;
this._Key = variance;
this._Value = variance;
}

@@ -942,3 +936,3 @@

return self => {
return reduceWithIndex(zero, (accumulator, _, value) => f(accumulator, value))(self);
return reduceWithIndex(zero, (accumulator, value, _) => f(accumulator, value))(self);
};

@@ -954,3 +948,3 @@ }

for (const [key, value] of self) {
accumulator = f(accumulator, key, value);
accumulator = f(accumulator, value, key);
}

@@ -957,0 +951,0 @@

/**
* @since 1.0.0
*/
import type * as HKT from "@fp-ts/core/HKT";
import type { Kind, TypeLambda } from "@fp-ts/core/HKT";
import * as applicative from "@fp-ts/core/typeclass/Applicative";
import * as chainable from "@fp-ts/core/typeclass/Chainable";
import * as compactable from "@fp-ts/core/typeclass/Compactable";
import type { Coproduct } from "@fp-ts/core/typeclass/Coproduct";
import * as covariant from "@fp-ts/core/typeclass/Covariant";
import * as filterable from "@fp-ts/core/typeclass/Filterable";
import * as flatMap_ from "@fp-ts/core/typeclass/FlatMap";
import * as foldable from "@fp-ts/core/typeclass/Foldable";
import * as invariant from "@fp-ts/core/typeclass/Invariant";
import type * as monad from "@fp-ts/core/typeclass/Monad";
import type { Monoid } from "@fp-ts/core/typeclass/Monoid";
import * as nonEmptyApplicative from "@fp-ts/core/typeclass/NonEmptyApplicative";
import * as nonEmptyProduct from "@fp-ts/core/typeclass/NonEmptyProduct";
import * as of_ from "@fp-ts/core/typeclass/Of";
import type { Order } from "@fp-ts/core/typeclass/Order";
import type * as pointed from "@fp-ts/core/typeclass/Pointed";
import * as product_ from "@fp-ts/core/typeclass/Product";
import type { Semigroup } from "@fp-ts/core/typeclass/Semigroup";
import * as traversable from "@fp-ts/core/typeclass/Traversable";
import * as traversableFilterable from "@fp-ts/core/typeclass/TraversableFilterable";
import type { Either } from "@fp-ts/data/Either";

@@ -33,3 +52,2 @@ import type * as Equal from "@fp-ts/data/Equal";

readonly _tag: "Cons";
readonly _A: (_: never) => A;
readonly head: A;

@@ -45,3 +63,2 @@ readonly tail: List<A>;

readonly _tag: "Nil";
readonly _A: (_: never) => A;
}

@@ -57,3 +74,3 @@ /**

*/
export interface ListTypeLambda extends HKT.TypeLambda {
export interface ListTypeLambda extends TypeLambda {
readonly type: List<this["Target"]>;

@@ -98,10 +115,2 @@ }

* @since 1.0.0
* @category filtering
*/
export declare const filter: {
<A, B extends A>(p: Refinement<A, B>): (self: List<A>) => List<B>;
<A>(p: Predicate<A>): (self: List<A>) => List<A>;
};
/**
* @since 1.0.0
* @category refinements

@@ -137,3 +146,3 @@ */

*/
export declare const concat: <B>(prefix: List<B>) => <A>(self: List<A>) => List<A | B>;
export declare const concat: <B>(that: List<B>) => <A>(self: List<A>) => List<A | B>;
/**

@@ -148,12 +157,2 @@ * @since 1.0.0

*/
export declare const partition: <A>(f: Predicate<A>) => (self: List<A>) => readonly [List<A>, List<A>];
/**
* @since 1.0.0
* @category partitioning
*/
export declare const partitionMap: <A, B, C>(f: (a: A) => Either<B, C>) => (self: List<A>) => readonly [List<B>, List<C>];
/**
* @since 1.0.0
* @category partitioning
*/
export declare const splitAt: (n: number) => <A>(self: List<A>) => readonly [List<A>, List<A>];

@@ -190,4 +189,4 @@ /**

export declare const findFirst: {
<A, B extends A>(p: Refinement<A, B>): (self: List<A>) => Option<B>;
<A>(p: Predicate<A>): (self: List<A>) => Option<A>;
<A, B extends A>(refinement: Refinement<A, B>): (self: List<A>) => Option<B>;
<A>(predicate: Predicate<A>): (self: List<A>) => Option<A>;
};

@@ -221,7 +220,2 @@ /**

* @since 1.0.0
* @category apply
*/
export declare const ap: <A>(fa: List<A>) => <B>(self: List<(a: A) => B>) => List<B>;
/**
* @since 1.0.0
* @category unsafe

@@ -244,4 +238,307 @@ */

*/
export declare const sortWith: <A>(O: Order<A>) => (self: List<A>) => List<A>;
export {};
export declare const sort: <A>(O: Order<A>) => (self: List<A>) => List<A>;
/**
* @since 1.0.0
* @category mapping
*/
export declare const imap: <A, B>(to: (a: A) => B, from: (b: B) => A) => (self: List<A>) => List<B>;
/**
* @since 1.0.0
* @category instances
*/
export declare const Invariant: invariant.Invariant<ListTypeLambda>;
/**
* @since 1.0.0
*/
export declare const tupled: <A>(self: List<A>) => List<readonly [A]>;
/**
* @since 1.0.0
*/
export declare const bindTo: <N extends string>(name: N) => <A>(self: List<A>) => List<{
readonly [K in N]: A;
}>;
/**
* @since 1.0.0
* @category instances
*/
export declare const Covariant: covariant.Covariant<ListTypeLambda>;
/**
* @category mapping
* @since 1.0.0
*/
export declare const as: <B>(b: B) => <_>(self: List<_>) => List<B>;
/**
* @category mapping
* @since 1.0.0
*/
export declare const asUnit: <_>(self: List<_>) => List<void>;
/**
* @category mapping
* @since 1.0.0
*/
export declare const flap: <A>(a: A) => <B>(self: List<(a: A) => B>) => List<B>;
declare const let_: <N extends string, A extends object, B>(name: Exclude<N, keyof A>, f: (a: A) => B) => (self: List<A>) => List<{
readonly [K in N | keyof A]: K extends keyof A ? A[K] : B;
}>;
export {
/**
* @category do notation
* @since 1.0.0
*/
let_ as let };
/**
* @since 1.0.0
* @category instances
*/
export declare const Of: of_.Of<ListTypeLambda>;
/**
* @since 1.0.0
*/
export declare const unit: List<void>;
/**
* @since 1.0.0
*/
export declare const Do: List<{}>;
/**
* @since 1.0.0
* @category instances
*/
export declare const Pointed: pointed.Pointed<ListTypeLambda>;
/**
* @since 1.0.0
* @category instances
*/
export declare const FlatMap: flatMap_.FlatMap<ListTypeLambda>;
/**
* @since 1.0.0
*/
export declare const flatten: <A>(self: List<List<A>>) => List<A>;
/**
* @since 1.0.0
*/
export declare const andThen: <B>(that: List<B>) => <_>(self: List<_>) => List<B>;
/**
* @since 1.0.0
*/
export declare const composeKleisliArrow: <B, C>(bfc: (b: B) => List<C>) => <A>(afb: (a: A) => List<B>) => (a: A) => List<C>;
/**
* @since 1.0.0
* @category instances
*/
export declare const Chainable: chainable.Chainable<ListTypeLambda>;
/**
* @since 1.0.0
*/
export declare const tap: <A, _>(f: (a: A) => List<_>) => (self: List<A>) => List<A>;
/**
* @since 1.0.0
*/
export declare const andThenDiscard: <_>(that: List<_>) => <A>(self: List<A>) => List<A>;
/**
* @category do notation
* @since 1.0.0
*/
export declare const bind: <N extends string, A extends object, B>(name: Exclude<N, keyof A>, f: (a: A) => List<B>) => (self: List<A>) => List<{
readonly [K in N | keyof A]: K extends keyof A ? A[K] : B;
}>;
/**
* @since 1.0.0
* @category instances
*/
export declare const Monad: monad.Monad<ListTypeLambda>;
/**
* @since 1.0.0
*/
export declare const product: <B>(that: List<B>) => <A>(self: List<A>) => List<readonly [A, B]>;
/**
* @since 1.0.0
*/
export declare const productMany: <A>(collection: Iterable<List<A>>) => (self: List<A>) => List<readonly [A, ...Array<A>]>;
/**
* @since 1.0.0
* @category instances
*/
export declare const NonEmptyProduct: nonEmptyProduct.NonEmptyProduct<ListTypeLambda>;
/**
* @since 1.0.0
*/
export declare const bindList: <N extends string, A extends object, B>(name: Exclude<N, keyof A>, fb: List<B>) => (self: List<A>) => List<{
readonly [K in N | keyof A]: K extends keyof A ? A[K] : B;
}>;
/**
* @since 1.0.0
*/
export declare const productFlatten: <B>(that: List<B>) => <A extends ReadonlyArray<any>>(self: List<A>) => List<readonly [...A, B]>;
/**
* @since 1.0.0
*/
export declare const productAll: <A>(collection: Iterable<List<A>>) => List<ReadonlyArray<A>>;
/**
* @since 1.0.0
* @category instances
*/
export declare const Product: product_.Product<ListTypeLambda>;
/**
* @since 1.0.0
*/
export declare const tuple: <T extends ReadonlyArray<List<any>>>(...components: T) => List<Readonly<{
[I in keyof T]: [T[I]] extends [List<infer A>] ? A : never;
}>>;
/**
* @since 1.0.0
*/
export declare const struct: <R extends Record<string, List<any>>>(fields: R) => List<{
readonly [K in keyof R]: [R[K]] extends [List<infer A>] ? A : never;
}>;
/**
* @since 1.0.0
* @category instances
*/
export declare const NonEmptyApplicative: nonEmptyApplicative.NonEmptyApplicative<ListTypeLambda>;
/**
* @since 1.0.0
*/
export declare const liftSemigroup: <A>(S: Semigroup<A>) => Semigroup<List<A>>;
/**
* @since 1.0.0
*/
export declare const ap: <A>(fa: List<A>) => <B>(self: List<(a: A) => B>) => List<B>;
/**
* @since 1.0.0
*/
export declare const lift2: <A, B, C>(f: (a: A, b: B) => C) => (fa: List<A>, fb: List<B>) => List<C>;
/**
* @since 1.0.0
*/
export declare const lift3: <A, B, C, D>(f: (a: A, b: B, c: C) => D) => (fa: List<A>, fb: List<B>, fc: List<C>) => List<D>;
/**
* @since 1.0.0
* @category instances
*/
export declare const Applicative: applicative.Applicative<ListTypeLambda>;
/**
* @since 1.0.0
*/
export declare const liftMonoid: <A>(M: Monoid<A>) => Monoid<List<A>>;
/**
* @since 1.0.0
*/
export declare const reduceRight: <A, B>(b: B, f: (b: B, a: A) => B) => (self: List<A>) => B;
/**
* @since 1.0.0
* @category instances
*/
export declare const Foldable: foldable.Foldable<ListTypeLambda>;
/**
* @since 1.0.0
*/
export declare const foldMap: <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => (self: List<A>) => M;
/**
* @since 1.0.0
*/
export declare const toReadonlyArray: <A>(self: List<A>) => ReadonlyArray<A>;
/**
* @since 1.0.0
*/
export declare const toReadonlyArrayWith: <A, B>(f: (a: A) => B) => (self: List<A>) => ReadonlyArray<B>;
/**
* @since 1.0.0
*/
export declare const reduceKind: <G extends TypeLambda>(G: monad.Monad<G>) => <B, A, R, O, E>(b: B, f: (b: B, a: A) => Kind<G, R, O, E, B>) => (self: List<A>) => Kind<G, R, O, E, B>;
/**
* @since 1.0.0
*/
export declare const reduceRightKind: <G extends TypeLambda>(G: monad.Monad<G>) => <B, A, R, O, E>(b: B, f: (b: B, a: A) => Kind<G, R, O, E, B>) => (self: List<A>) => Kind<G, R, O, E, B>;
/**
* @since 1.0.0
*/
export declare const foldMapKind: <G extends TypeLambda>(G: Coproduct<G>) => <A, R, O, E, B>(f: (a: A) => Kind<G, R, O, E, B>) => (self: List<A>) => Kind<G, R, O, E, B>;
/**
* @since 1.0.0
*/
export declare const compact: <A>(self: List<Option<A>>) => List<A>;
/**
* @since 1.0.0
* @category instances
*/
export declare const Compactable: compactable.Compactable<ListTypeLambda>;
/**
* @since 1.0.0
*/
export declare const separate: <A, B>(self: List<Either<A, B>>) => readonly [List<A>, List<B>];
/**
* @since 1.0.0
*/
export declare const filterMap: <A, B>(f: (a: A) => Option<B>) => (self: List<A>) => List<B>;
/**
* @since 1.0.0
* @category instances
*/
export declare const Filterable: filterable.Filterable<ListTypeLambda>;
/**
* @since 1.0.0
* @category filtering
*/
export declare const filter: {
<C extends A, B extends A, A = C>(refinement: (a: A) => a is B): (self: List<C>) => List<B>;
<B extends A, A = B>(predicate: (a: A) => boolean): (self: List<B>) => List<B>;
};
/**
* @since 1.0.0
* @category filtering
*/
export declare const partition: {
<C extends A, B extends A, A = C>(refinement: (a: A) => a is B): (self: List<C>) => readonly [List<C>, List<B>];
<B extends A, A = B>(predicate: (a: A) => boolean): (self: List<B>) => readonly [List<B>, List<B>];
};
/**
* @since 1.0.0
* @category filtering
*/
export declare const partitionMap: <A, B, C>(f: (a: A) => Either<B, C>) => (self: List<A>) => readonly [List<B>, List<C>];
/**
* @since 1.0.0
* @category traversing
*/
export declare const traverse: <F extends TypeLambda>(F: applicative.Applicative<F>) => <A, R, O, E, B>(f: (a: A) => Kind<F, R, O, E, B>) => (self: List<A>) => Kind<F, R, O, E, List<B>>;
/**
* @since 1.0.0
* @category traversing
*/
export declare const sequence: <F extends TypeLambda>(F: applicative.Applicative<F>) => <R, O, E, A>(self: List<Kind<F, R, O, E, A>>) => Kind<F, R, O, E, List<A>>;
/**
* @since 1.0.0
* @category instances
*/
export declare const Traversable: traversable.Traversable<ListTypeLambda>;
/**
* @since 1.0.0
* @category traversing
*/
export declare const traverseTap: <F extends TypeLambda>(F: applicative.Applicative<F>) => <A, R, O, E, B>(f: (a: A) => Kind<F, R, O, E, B>) => (self: List<A>) => Kind<F, R, O, E, List<A>>;
/**
* @category filtering
* @since 1.0.0
*/
export declare const traverseFilterMap: <F extends TypeLambda>(F: applicative.Applicative<F>) => <A, R, O, E, B>(f: (a: A) => Kind<F, R, O, E, Option<B>>) => (self: List<A>) => Kind<F, R, O, E, List<B>>;
/**
* @category filtering
* @since 1.0.0
*/
export declare const traversePartitionMap: <F extends TypeLambda>(F: applicative.Applicative<F>) => <A, R, O, E, B, C>(f: (a: A) => Kind<F, R, O, E, Either<B, C>>) => (self: List<A>) => Kind<F, R, O, E, readonly [List<B>, List<C>]>;
/**
* @category instances
* @since 1.0.0
*/
export declare const TraversableFilterable: traversableFilterable.TraversableFilterable<ListTypeLambda>;
/**
* @since 1.0.0
* @category filtering
*/
export declare const traverseFilter: <F extends TypeLambda>(F: applicative.Applicative<F>) => <B extends A, R, O, E, A = B>(predicate: (a: A) => Kind<F, R, O, E, boolean>) => (self: List<B>) => Kind<F, R, O, E, List<B>>;
/**
* @since 1.0.0
* @category filtering
*/
export declare const traversePartition: <F extends TypeLambda>(F: applicative.Applicative<F>) => <B extends A, R, O, E, A = B>(predicate: (a: A) => Kind<F, R, O, E, boolean>) => (self: List<B>) => Kind<F, R, O, E, readonly [List<B>, List<B>]>;
//# sourceMappingURL=List.d.ts.map

@@ -6,9 +6,35 @@ "use strict";

});
exports.unsafeTail = exports.unsafeLast = exports.unsafeHead = exports.take = exports.tail = exports.splitAt = exports.sortWith = exports.some = exports.reverse = exports.reduce = exports.prependAll = exports.prepend = exports.partitionMap = exports.partition = exports.of = exports.nil = exports.map = exports.make = exports.isNil = exports.isList = exports.isCons = exports.head = exports.fromIterable = exports.forEach = exports.flatMap = exports.findFirst = exports.filter = exports.every = exports.empty = exports.drop = exports.cons = exports.concat = exports.ap = exports.List = void 0;
exports.unsafeTail = exports.unsafeLast = exports.unsafeHead = exports.unit = exports.tupled = exports.tuple = exports.traverseTap = exports.traversePartitionMap = exports.traversePartition = exports.traverseFilterMap = exports.traverseFilter = exports.traverse = exports.toReadonlyArrayWith = exports.toReadonlyArray = exports.tap = exports.take = exports.tail = exports.struct = exports.splitAt = exports.sort = exports.some = exports.sequence = exports.separate = exports.reverse = exports.reduceRightKind = exports.reduceRight = exports.reduceKind = exports.reduce = exports.productMany = exports.productFlatten = exports.productAll = exports.product = exports.prependAll = exports.prepend = exports.partitionMap = exports.partition = exports.of = exports.nil = exports.map = exports.make = exports.liftSemigroup = exports.liftMonoid = exports.lift3 = exports.lift2 = exports.let = exports.isNil = exports.isList = exports.isCons = exports.imap = exports.head = exports.fromIterable = exports.forEach = exports.foldMapKind = exports.foldMap = exports.flatten = exports.flatMap = exports.flap = exports.findFirst = exports.filterMap = exports.filter = exports.every = exports.empty = exports.drop = exports.cons = exports.concat = exports.composeKleisliArrow = exports.compact = exports.bindTo = exports.bindList = exports.bind = exports.asUnit = exports.as = exports.ap = exports.andThenDiscard = exports.andThen = exports.TraversableFilterable = exports.Traversable = exports.Product = exports.Pointed = exports.Of = exports.NonEmptyProduct = exports.NonEmptyApplicative = exports.Monad = exports.List = exports.Invariant = exports.Foldable = exports.FlatMap = exports.Filterable = exports.Do = exports.Covariant = exports.Compactable = exports.Chainable = exports.Applicative = void 0;
var _Function = /*#__PURE__*/require("@fp-ts/data/Function");
var applicative = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Applicative"));
var chainable = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Chainable"));
var compactable = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Compactable"));
var covariant = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Covariant"));
var filterable = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Filterable"));
var flatMap_ = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/FlatMap"));
var foldable = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Foldable"));
var invariant = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Invariant"));
var nonEmptyApplicative = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/NonEmptyApplicative"));
var nonEmptyProduct = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/NonEmptyProduct"));
var of_ = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Of"));
var product_ = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Product"));
var traversable = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Traversable"));
var traversableFilterable = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/TraversableFilterable"));
var LI = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/internal/List"));
var _sortWith = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/internal/List/sortWith"));
var _sort = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/internal/List/sort"));

@@ -73,13 +99,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

* @since 1.0.0
* @category filtering
* @category refinements
*/
exports.take = take;
const filter = LI.filter;
/**
* @since 1.0.0
* @category refinements
*/
exports.filter = filter;
const isList = LI.isList;

@@ -134,16 +153,2 @@ /**

exports.reverse = reverse;
const partition = LI.partition;
/**
* @since 1.0.0
* @category partitioning
*/
exports.partition = partition;
const partitionMap = LI.partitionMap;
/**
* @since 1.0.0
* @category partitioning
*/
exports.partitionMap = partitionMap;
const splitAt = LI.splitAt;

@@ -229,15 +234,6 @@ /**

* @since 1.0.0
* @category apply
* @category unsafe
*/
exports.reduce = reduce;
const ap = fa => fab => (0, _Function.pipe)(fab, flatMap(f => (0, _Function.pipe)(fa, map(a => f(a)))));
/**
* @since 1.0.0
* @category unsafe
*/
exports.ap = ap;
const unsafeHead = LI.unsafeHead;

@@ -264,4 +260,448 @@ /**

exports.unsafeLast = unsafeLast;
const sortWith = _sortWith.sortWith;
exports.sortWith = sortWith;
const sort = _sort.sort;
/**
* @since 1.0.0
* @category mapping
*/
exports.sort = sort;
const imap = LI.imap;
/**
* @since 1.0.0
* @category instances
*/
exports.imap = imap;
const Invariant = LI.Invariant;
/**
* @since 1.0.0
*/
exports.Invariant = Invariant;
const tupled = /*#__PURE__*/invariant.tupled(Invariant);
/**
* @since 1.0.0
*/
exports.tupled = tupled;
const bindTo = /*#__PURE__*/invariant.bindTo(Invariant);
/**
* @since 1.0.0
* @category instances
*/
exports.bindTo = bindTo;
const Covariant = LI.Covariant;
/**
* @category mapping
* @since 1.0.0
*/
exports.Covariant = Covariant;
const as = /*#__PURE__*/covariant.as(Covariant);
/**
* @category mapping
* @since 1.0.0
*/
exports.as = as;
const asUnit = /*#__PURE__*/covariant.asUnit(Covariant);
/**
* @category mapping
* @since 1.0.0
*/
exports.asUnit = asUnit;
const flap = /*#__PURE__*/covariant.flap(Covariant);
exports.flap = flap;
const let_ = /*#__PURE__*/covariant.let(Covariant);
exports.let = let_;
/**
* @since 1.0.0
* @category instances
*/
const Of = {
of
};
/**
* @since 1.0.0
*/
exports.Of = Of;
const unit = /*#__PURE__*/of_.unit(Of);
/**
* @since 1.0.0
*/
exports.unit = unit;
const Do = /*#__PURE__*/of_.Do(Of);
/**
* @since 1.0.0
* @category instances
*/
exports.Do = Do;
const Pointed = { ...Covariant,
...Of
};
/**
* @since 1.0.0
* @category instances
*/
exports.Pointed = Pointed;
const FlatMap = {
flatMap
};
/**
* @since 1.0.0
*/
exports.FlatMap = FlatMap;
const flatten = /*#__PURE__*/flatMap_.flatten(FlatMap);
/**
* @since 1.0.0
*/
exports.flatten = flatten;
const andThen = /*#__PURE__*/flatMap_.andThen(FlatMap);
/**
* @since 1.0.0
*/
exports.andThen = andThen;
const composeKleisliArrow = /*#__PURE__*/flatMap_.composeKleisliArrow(FlatMap);
/**
* @since 1.0.0
* @category instances
*/
exports.composeKleisliArrow = composeKleisliArrow;
const Chainable = { ...FlatMap,
...Covariant
};
/**
* @since 1.0.0
*/
exports.Chainable = Chainable;
const tap = /*#__PURE__*/chainable.tap(Chainable);
/**
* @since 1.0.0
*/
exports.tap = tap;
const andThenDiscard = /*#__PURE__*/chainable.andThenDiscard(Chainable);
/**
* @category do notation
* @since 1.0.0
*/
exports.andThenDiscard = andThenDiscard;
const bind = /*#__PURE__*/chainable.bind(Chainable);
/**
* @since 1.0.0
* @category instances
*/
exports.bind = bind;
const Monad = { ...Chainable,
...Of
};
/**
* @since 1.0.0
*/
exports.Monad = Monad;
const product = LI.product;
/**
* @since 1.0.0
*/
exports.product = product;
const productMany = LI.productMany;
/**
* @since 1.0.0
* @category instances
*/
exports.productMany = productMany;
const NonEmptyProduct = { ...Invariant,
product,
productMany
};
/**
* @since 1.0.0
*/
exports.NonEmptyProduct = NonEmptyProduct;
const bindList = /*#__PURE__*/nonEmptyProduct.bindKind(NonEmptyProduct);
/**
* @since 1.0.0
*/
exports.bindList = bindList;
const productFlatten = /*#__PURE__*/nonEmptyProduct.productFlatten(NonEmptyProduct);
/**
* @since 1.0.0
*/
exports.productFlatten = productFlatten;
const productAll = LI.productAll;
/**
* @since 1.0.0
* @category instances
*/
exports.productAll = productAll;
const Product = { ...NonEmptyProduct,
...Of,
productAll
};
/**
* @since 1.0.0
*/
exports.Product = Product;
const tuple = /*#__PURE__*/product_.tuple(Product);
/**
* @since 1.0.0
*/
exports.tuple = tuple;
const struct = /*#__PURE__*/product_.struct(Product);
/**
* @since 1.0.0
* @category instances
*/
exports.struct = struct;
const NonEmptyApplicative = { ...NonEmptyProduct,
...Covariant
};
/**
* @since 1.0.0
*/
exports.NonEmptyApplicative = NonEmptyApplicative;
const liftSemigroup = /*#__PURE__*/nonEmptyApplicative.liftSemigroup(NonEmptyApplicative);
/**
* @since 1.0.0
*/
exports.liftSemigroup = liftSemigroup;
const ap = /*#__PURE__*/nonEmptyApplicative.ap(NonEmptyApplicative);
/**
* @since 1.0.0
*/
exports.ap = ap;
const lift2 = /*#__PURE__*/nonEmptyApplicative.lift2(NonEmptyApplicative);
/**
* @since 1.0.0
*/
exports.lift2 = lift2;
const lift3 = /*#__PURE__*/nonEmptyApplicative.lift3(NonEmptyApplicative);
/**
* @since 1.0.0
* @category instances
*/
exports.lift3 = lift3;
const Applicative = { ...NonEmptyApplicative,
...Product
};
/**
* @since 1.0.0
*/
exports.Applicative = Applicative;
const liftMonoid = /*#__PURE__*/applicative.liftMonoid(Applicative);
/**
* @since 1.0.0
*/
exports.liftMonoid = liftMonoid;
const reduceRight = LI.reduceRight;
/**
* @since 1.0.0
* @category instances
*/
exports.reduceRight = reduceRight;
const Foldable = {
reduce
};
/**
* @since 1.0.0
*/
exports.Foldable = Foldable;
const foldMap = /*#__PURE__*/foldable.foldMap(Foldable);
/**
* @since 1.0.0
*/
exports.foldMap = foldMap;
const toReadonlyArray = /*#__PURE__*/foldable.toReadonlyArray(Foldable);
/**
* @since 1.0.0
*/
exports.toReadonlyArray = toReadonlyArray;
const toReadonlyArrayWith = /*#__PURE__*/foldable.toReadonlyArrayWith(Foldable);
/**
* @since 1.0.0
*/
exports.toReadonlyArrayWith = toReadonlyArrayWith;
const reduceKind = /*#__PURE__*/foldable.reduceKind(Foldable);
/**
* @since 1.0.0
*/
exports.reduceKind = reduceKind;
const reduceRightKind = /*#__PURE__*/foldable.reduceRightKind(Foldable);
/**
* @since 1.0.0
*/
exports.reduceRightKind = reduceRightKind;
const foldMapKind = /*#__PURE__*/foldable.foldMapKind(Foldable);
/**
* @since 1.0.0
*/
exports.foldMapKind = foldMapKind;
const compact = LI.compact;
/**
* @since 1.0.0
* @category instances
*/
exports.compact = compact;
const Compactable = {
compact
};
/**
* @since 1.0.0
*/
exports.Compactable = Compactable;
const separate = /*#__PURE__*/compactable.separate({ ...Compactable,
...Covariant
});
/**
* @since 1.0.0
*/
exports.separate = separate;
const filterMap = LI.filterMap;
/**
* @since 1.0.0
* @category instances
*/
exports.filterMap = filterMap;
const Filterable = {
filterMap
};
/**
* @since 1.0.0
* @category filtering
*/
exports.Filterable = Filterable;
const filter = /*#__PURE__*/filterable.filter(Filterable);
/**
* @since 1.0.0
* @category filtering
*/
exports.filter = filter;
const partition = /*#__PURE__*/filterable.partition(Filterable);
/**
* @since 1.0.0
* @category filtering
*/
exports.partition = partition;
const partitionMap = /*#__PURE__*/filterable.partitionMap(Filterable);
/**
* @since 1.0.0
* @category traversing
*/
exports.partitionMap = partitionMap;
const traverse = LI.traverse;
/**
* @since 1.0.0
* @category traversing
*/
exports.traverse = traverse;
const sequence = /*#__PURE__*/traversable.sequence(traverse);
/**
* @since 1.0.0
* @category instances
*/
exports.sequence = sequence;
const Traversable = {
traverse,
sequence
};
/**
* @since 1.0.0
* @category traversing
*/
exports.Traversable = Traversable;
const traverseTap = /*#__PURE__*/traversable.traverseTap(Traversable);
/**
* @category filtering
* @since 1.0.0
*/
exports.traverseTap = traverseTap;
const traverseFilterMap = /*#__PURE__*/traversableFilterable.traverseFilterMap({ ...Traversable,
...Compactable
});
/**
* @category filtering
* @since 1.0.0
*/
exports.traverseFilterMap = traverseFilterMap;
const traversePartitionMap = /*#__PURE__*/traversableFilterable.traversePartitionMap({ ...Traversable,
...Covariant,
...Compactable
});
/**
* @category instances
* @since 1.0.0
*/
exports.traversePartitionMap = traversePartitionMap;
const TraversableFilterable = {
traverseFilterMap,
traversePartitionMap
};
/**
* @since 1.0.0
* @category filtering
*/
exports.TraversableFilterable = TraversableFilterable;
const traverseFilter = /*#__PURE__*/traversableFilterable.traverseFilter(TraversableFilterable);
/**
* @since 1.0.0
* @category filtering
*/
exports.traverseFilter = traverseFilter;
const traversePartition = /*#__PURE__*/traversableFilterable.traversePartition(TraversableFilterable);
exports.traversePartition = traversePartition;
//# sourceMappingURL=List.js.map

@@ -19,4 +19,2 @@ /**

readonly _id: TypeId;
readonly _K: (_: K) => K;
readonly _V: (_: never) => V;
}

@@ -23,0 +21,0 @@ /**

@@ -62,7 +62,2 @@ "use strict";

this._id = TypeId;
this._K = _ => _;
this._V = _ => _;
this.backingMap = new Map();

@@ -69,0 +64,0 @@ this.length = 0;

@@ -17,3 +17,2 @@ /**

readonly _id: TypeId;
readonly _A: (_: never) => A;
}

@@ -20,0 +19,0 @@ /**

@@ -18,13 +18,7 @@ "use strict";

const TypeId = /*#__PURE__*/Symbol.for("@fp-ts/data/MutableList");
function variance(_) {
return _;
}
/** @internal */
class MutableListImpl {
constructor() {
this._id = TypeId;
this._A = variance;
this.head = undefined;

@@ -31,0 +25,0 @@ this.tail = undefined;

@@ -23,3 +23,2 @@ /**

readonly _id: TypeId;
readonly _A: (_: never) => A;
}

@@ -26,0 +25,0 @@ /**

@@ -28,9 +28,5 @@ "use strict";

const EmptyMutableQueue = /*#__PURE__*/Symbol.for("@fp-ts/data/mutable/MutableQueue/Empty");
exports.EmptyMutableQueue = EmptyMutableQueue;
function variance(_) {
return _;
}
/** @internal */
exports.EmptyMutableQueue = EmptyMutableQueue;

@@ -42,3 +38,2 @@ class MutableQueueImpl {

this._id = TypeId;
this._A = variance;
this.queue = MutableList.empty();

@@ -45,0 +40,0 @@ }

@@ -8,2 +8,3 @@ /**

import * as semigroup from "@fp-ts/core/typeclass/Semigroup";
import type { Ordering } from "@fp-ts/data/Ordering";
import type { Refinement } from "@fp-ts/data/Refinement";

@@ -89,2 +90,6 @@ /**

export declare const MonoidMultiply: monoid.Monoid<number>;
/**
* @since 1.0.0
*/
export declare const sign: (n: number) => Ordering;
//# sourceMappingURL=Number.d.ts.map

@@ -6,3 +6,3 @@ "use strict";

});
exports.sum = exports.sub = exports.multiply = exports.isNumber = exports.increment = exports.decrement = exports.SemigroupSum = exports.SemigroupMultiply = exports.Order = exports.MonoidSum = exports.MonoidMultiply = exports.Bounded = void 0;
exports.sum = exports.sub = exports.sign = exports.multiply = exports.isNumber = exports.increment = exports.decrement = exports.SemigroupSum = exports.SemigroupMultiply = exports.Order = exports.MonoidSum = exports.MonoidMultiply = exports.Bounded = void 0;

@@ -158,3 +158,11 @@ var semigroup = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Semigroup"));

};
/**
* @since 1.0.0
*/
exports.MonoidMultiply = MonoidMultiply;
const sign = n => n < 0 ? -1 : n > 0 ? 1 : 0;
exports.sign = sign;
//# sourceMappingURL=Number.js.map

@@ -476,11 +476,11 @@ /**

/**
* @category instances
* @category traversing
* @since 1.0.0
*/
export declare const Traversable: traversable.Traversable<OptionTypeLambda>;
export declare const sequence: <F extends TypeLambda>(F: applicative.Applicative<F>) => <R, O, E, A>(fas: Option<Kind<F, R, O, E, A>>) => Kind<F, R, O, E, Option<A>>;
/**
* @category traversing
* @category instances
* @since 1.0.0
*/
export declare const sequence: <F extends TypeLambda>(F: applicative.Applicative<F>) => <R, O, E, A>(fas: Option<Kind<F, R, O, E, A>>) => Kind<F, R, O, E, Option<A>>;
export declare const Traversable: traversable.Traversable<OptionTypeLambda>;
/**

@@ -487,0 +487,0 @@ * @category traversing

@@ -601,4 +601,3 @@ "use strict";

const Foldable = {
reduce,
reduceRight
reduce
};

@@ -720,3 +719,3 @@ /**

/**
* @category instances
* @category traversing
* @since 1.0.0

@@ -727,12 +726,13 @@ */

exports.traverse = traverse;
const Traversable = {
traverse
};
const sequence = /*#__PURE__*/traversable.sequence(traverse);
/**
* @category traversing
* @category instances
* @since 1.0.0
*/
exports.Traversable = Traversable;
const sequence = /*#__PURE__*/traversable.sequence(Traversable);
exports.sequence = sequence;
const Traversable = {
traverse,
sequence
};
/**

@@ -743,3 +743,3 @@ * @category traversing

exports.sequence = sequence;
exports.Traversable = Traversable;
const traverseTap = /*#__PURE__*/traversable.traverseTap(Traversable);

@@ -746,0 +746,0 @@ /**

/**
* @since 3.0.0
* @since 1.0.0
*/

@@ -9,7 +9,7 @@ import * as monoid from "@fp-ts/core/typeclass/Monoid";

* @category model
* @since 3.0.0
* @since 1.0.0
*/
export declare type Ordering = -1 | 0 | 1;
/**
* @since 3.0.0
* @since 1.0.0
*/

@@ -19,3 +19,3 @@ export declare const reverse: (o: Ordering) => Ordering;

* @category pattern matching
* @since 3.0.0
* @since 1.0.0
*/

@@ -25,3 +25,3 @@ export declare const match: <A, B, C = B>(onLessThan: LazyArg<A>, onEqual: LazyArg<B>, onGreaterThan: LazyArg<C>) => (o: Ordering) => A | B | C;

* @category instances
* @since 3.0.0
* @since 1.0.0
*/

@@ -31,9 +31,5 @@ export declare const Semigroup: semigroup.Semigroup<Ordering>;

* @category instances
* @since 3.0.0
* @since 1.0.0
*/
export declare const Monoid: monoid.Monoid<Ordering>;
/**
* @since 3.0.0
*/
export declare const sign: (n: number) => Ordering;
//# sourceMappingURL=Ordering.d.ts.map

@@ -6,3 +6,3 @@ "use strict";

});
exports.sign = exports.reverse = exports.match = exports.Semigroup = exports.Monoid = void 0;
exports.reverse = exports.match = exports.Semigroup = exports.Monoid = void 0;

@@ -16,7 +16,7 @@ var monoid = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Monoid"));

/**
* @since 3.0.0
* @since 1.0.0
*/
/**
* @since 3.0.0
* @since 1.0.0
*/

@@ -26,3 +26,3 @@ const reverse = o => o === -1 ? 1 : o === 1 ? -1 : 0;

* @category pattern matching
* @since 3.0.0
* @since 1.0.0
*/

@@ -36,3 +36,3 @@

* @category instances
* @since 3.0.0
* @since 1.0.0
*/

@@ -62,17 +62,8 @@

* @category instances
* @since 3.0.0
* @since 1.0.0
*/
exports.Semigroup = Semigroup;
const Monoid = /*#__PURE__*/monoid.fromSemigroup(Semigroup, 0); // TODO: move to Number module
/**
* @since 3.0.0
*/
const Monoid = /*#__PURE__*/monoid.fromSemigroup(Semigroup, 0);
exports.Monoid = Monoid;
const sign = n => n <= -1 ? -1 : n >= 1 ? 1 : 0;
exports.sign = sign;
//# sourceMappingURL=Ordering.js.map
{
"name": "@fp-ts/data",
"version": "0.0.8",
"version": "0.0.9",
"license": "MIT",

@@ -10,3 +10,3 @@ "repository": {

"dependencies": {
"@fp-ts/core": "^0.0.6"
"@fp-ts/core": "^0.0.7"
},

@@ -13,0 +13,0 @@ "main": "./index.js",

@@ -21,3 +21,2 @@ /**

readonly _id: TypeId;
readonly _A: (_: never) => A;
}

@@ -24,0 +23,0 @@ /**

@@ -13,3 +13,3 @@ /**

import * as foldable from "@fp-ts/core/typeclass/Foldable";
import * as invariant from "@fp-ts/core/typeclass/Invariant";
import type * as invariant from "@fp-ts/core/typeclass/Invariant";
import type * as monad from "@fp-ts/core/typeclass/Monad";

@@ -19,3 +19,3 @@ import type { Monoid } from "@fp-ts/core/typeclass/Monoid";

import * as nonEmptyProduct from "@fp-ts/core/typeclass/NonEmptyProduct";
import type * as of_ from "@fp-ts/core/typeclass/Of";
import * as of_ from "@fp-ts/core/typeclass/Of";
import * as order from "@fp-ts/core/typeclass/Order";

@@ -29,5 +29,3 @@ import type { Order } from "@fp-ts/core/typeclass/Order";

import type { Either } from "@fp-ts/data/Either";
import type { Endomorphism } from "@fp-ts/data/Endomorphism";
import type { LazyArg } from "@fp-ts/data/Function";
import type { NonEmptyReadonlyArray } from "@fp-ts/data/NonEmptyReadonlyArray";
import type { Option } from "@fp-ts/data/Option";

@@ -45,30 +43,25 @@ import type { Predicate } from "@fp-ts/data/Predicate";

/**
* @category conversions
* @category models
* @since 1.0.0
*/
export declare const fromIterable: <A>(collection: Iterable<A>) => ReadonlyArray<A>;
export declare type NonEmptyReadonlyArray<A> = readonly [A, ...ReadonlyArray<A>];
/**
* Builds a `NonEmptyReadonlyArray` from an non-empty collection of elements.
*
* @category constructors
* @since 1.0.0
*/
export declare const make: <As extends readonly [any, ...any[]]>(...as: As) => readonly [As[number], ...As[number][]];
/**
* Return a `ReadonlyArray` of length `n` with element `i` initialized with `f(i)`.
*
* **Note**. `n` is normalized to a non negative integer.
* **Note**. `n` is normalized to an integer >= 1.
*
* @exampleTodo
* import { makeBy } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const double = (n: number): number => n * 2
* assert.deepStrictEqual(pipe(5, makeBy(double)), [0, 2, 4, 6, 8])
*
* @category constructors
* @since 1.0.0
*/
export declare const makeBy: <A>(f: (i: number) => A) => (n: number) => readonly A[];
export declare const makeBy: <A>(f: (i: number) => A) => (n: number) => readonly [A, ...A[]];
/**
* Create a `ReadonlyArray` containing a range of integers, including both endpoints.
* Create a non empty `ReadonlyArray` containing a range of integers, including both endpoints.
*
* @exampleTodo
* import { range } from '@fp-ts/data/ReadonlyArray'
*
* assert.deepStrictEqual(range(1, 5), [1, 2, 3, 4, 5])
*
* @category constructors

@@ -81,14 +74,8 @@ * @since 1.0.0

*
* **Note**. `n` is normalized to a non negative integer.
* **Note**. `n` is normalized to an integer >= 1.
*
* @exampleTodo
* import { replicate } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe(3, replicate('a')), ['a', 'a', 'a'])
*
* @category constructors
* @since 1.0.0
*/
export declare const replicate: <A>(a: A) => (n: number) => readonly A[];
export declare const replicate: <A>(a: A) => (n: number) => readonly [A, ...A[]];
/**

@@ -98,141 +85,119 @@ * @category conversions

*/
export declare const fromOption: <A>(fa: Option<A>) => ReadonlyArray<A>;
export declare const fromIterable: <A>(collection: Iterable<A>) => ReadonlyArray<A>;
/**
* Converts an `Either` to a `ReadonlyArray`.
*
* @category conversions
* @since 1.0.0
*/
export declare const fromEither: <A>(fa: Either<unknown, A>) => ReadonlyArray<A>;
export declare const fromOption: <A>(o: Option<A>) => readonly A[];
/**
* @category conversions
* @since 1.0.0
*/
export declare const fromEither: <A>(e: Either<unknown, A>) => readonly A[];
/**
* @category pattern matching
* @since 1.0.0
*/
export declare const match: <B, A, C = B>(onEmpty: LazyArg<B>, onNonEmpty: (as: readonly [A, ...A[]]) => C) => (as: readonly A[]) => B | C;
export declare const match: <B, A, C = B>(onEmpty: LazyArg<B>, onNonEmpty: (head: A, tail: readonly A[]) => C) => (self: readonly A[]) => B | C;
/**
* Break a `ReadonlyArray` into its first element and remaining elements.
*
* @exampleTodo
* import { matchLeft } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* const len: <A>(as: ReadonlyArray<A>) => number = matchLeft(() => 0, (_, tail) => 1 + len(tail))
* assert.strictEqual(len([1, 2, 3]), 3)
*
* @category pattern matching
* @since 1.0.0
*/
export declare const matchLeft: <B, A, C = B>(onEmpty: LazyArg<B>, onNonEmpty: (head: A, tail: readonly A[]) => C) => (as: readonly A[]) => B | C;
export declare const matchRight: <B, A, C = B>(onEmpty: LazyArg<B>, onNonEmpty: (init: readonly A[], last: A) => C) => (self: readonly A[]) => B | C;
/**
* Break a `ReadonlyArray` into its initial elements and the last element.
* Prepend an element to the front of a `ReadonlyArray`, creating a new non empty `ReadonlyArray`.
*
* @category pattern matching
* @category mutations
* @since 1.0.0
*/
export declare const matchRight: <B, A, C = B>(onEmpty: LazyArg<B>, onNonEmpty: (init: readonly A[], last: A) => C) => (as: readonly A[]) => B | C;
export declare const prepend: <B>(head: B) => <A>(self: readonly A[]) => readonly [B | A, ...(B | A)[]];
/**
* @category mutations
* @since 1.0.0
*/
export declare const concat: <B>(that: readonly B[]) => <A>(self: readonly A[]) => readonly (B | A)[];
export declare const prependAll: <B>(prefix: readonly B[]) => <A>(self: readonly A[]) => readonly (B | A)[];
/**
* @category mutations
* @since 1.0.0
*/
export declare function prependAllNonEmpty<B>(that: NonEmptyReadonlyArray<B>): <A>(self: ReadonlyArray<A>) => NonEmptyReadonlyArray<A | B>;
export declare function prependAllNonEmpty<B>(that: ReadonlyArray<B>): <A>(self: NonEmptyReadonlyArray<A>) => NonEmptyReadonlyArray<A | B>;
/**
* Append an element to the end of a `ReadonlyArray`, creating a new non empty `ReadonlyArray`.
*
* @category mutations
* @since 1.0.0
*/
export declare const append: <B>(last: B) => <A>(self: readonly A[]) => readonly [B | A, ...(B | A)[]];
/**
* @category mutations
* @since 1.0.0
*/
export declare const appendAll: <B>(that: readonly B[]) => <A>(self: readonly A[]) => readonly (B | A)[];
/**
* @category mutations
* @since 1.0.0
*/
export declare function appendAllNonEmpty<B>(that: NonEmptyReadonlyArray<B>): <A>(self: ReadonlyArray<A>) => NonEmptyReadonlyArray<A | B>;
export declare function appendAllNonEmpty<B>(that: ReadonlyArray<B>): <A>(self: NonEmptyReadonlyArray<A>) => NonEmptyReadonlyArray<A | B>;
/**
* Fold a `ReadonlyArray` from the left, keeping all intermediate results instead of only the final result.
*
* @exampleTodo
* import { scanLeft } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.deepStrictEqual(scanLeft(10, (b, a: number) => b - a)([1, 2, 3]), [10, 9, 7, 4])
*
* @category folding
* @since 1.0.0
*/
export declare const scanLeft: <B, A>(b: B, f: (b: B, a: A) => B) => (as: readonly A[]) => readonly [B, ...B[]];
export declare const scan: <B, A>(b: B, f: (b: B, a: A) => B) => (self: readonly A[]) => readonly [B, ...B[]];
/**
* Fold a `ReadonlyArray` from the right, keeping all intermediate results instead of only the final result.
*
* @exampleTodo
* import { scanRight } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.deepStrictEqual(scanRight(10, (a: number, b) => b - a)([1, 2, 3]), [4, 5, 7, 10])
*
* @category folding
* @since 1.0.0
*/
export declare const scanRight: <B, A>(b: B, f: (a: A, b: B) => B) => (as: readonly A[]) => readonly [B, ...B[]];
export declare const scanRight: <B, A>(b: B, f: (b: B, a: A) => B) => (self: readonly A[]) => readonly [B, ...B[]];
/**
* Test whether a `ReadonlyArray` is empty.
*
* @exampleTodo
* import { isEmpty } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.strictEqual(isEmpty([]), true)
*
* @category predicates
* @since 1.0.0
*/
export declare const isEmpty: <A>(as: readonly A[]) => as is readonly [];
export declare const isEmpty: <A>(self: readonly A[]) => self is readonly [];
/**
* Test whether a `ReadonlyArray` is non empty narrowing down the type to `NonEmptyReadonlyArray<A>`
*
* @category refinements
* @category predicates
* @since 1.0.0
*/
export declare const isNonEmpty: <A>(as: ReadonlyArray<A>) => as is NonEmptyReadonlyArray<A>;
export declare const isNonEmpty: <A>(self: ReadonlyArray<A>) => self is NonEmptyReadonlyArray<A>;
/**
* Calculate the number of elements in a `ReadonlyArray`.
*
* @category getters
* @since 1.0.0
*/
export declare const size: <A>(as: readonly A[]) => number;
export declare const size: <A>(self: readonly A[]) => number;
/**
* Test whether a `ReadonlyArray` contains a particular index
*
* @since 1.0.0
*/
export declare const isOutOfBound: <A>(i: number, as: ReadonlyArray<A>) => boolean;
/**
* This function provides a safe way to read a value at a particular index from a `ReadonlyArray`
*
* @exampleTodo
* import { lookup } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2, 3], lookup(1)), some(2))
* assert.deepStrictEqual(pipe([1, 2, 3], lookup(3)), none)
*
* @category getters
* @since 1.0.0
*/
export declare const lookup: (i: number) => <A>(as: readonly A[]) => Option<A>;
export declare const get: (i: number) => <A>(self: readonly A[]) => Option<A>;
/**
* Prepend an element to the front of a `ReadonlyArray`, creating a new `NonEmptyReadonlyArray`.
* Produces a couple of the first element of the array, and a new array of the remaining elements, if any.
*
* @exampleTodo
* import { prepend } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2, 3], prepend(0)), [0, 1, 2, 3])
*
* @category constructors
* @category getters
* @since 1.0.0
*/
export declare const prepend: <B>(head: B) => <A>(tail: ReadonlyArray<A>) => NonEmptyReadonlyArray<A | B>;
export declare const unprepend: <A>(self: readonly [A, ...A[]]) => readonly [A, readonly A[]];
/**
* Append an element to the end of a `ReadonlyArray`, creating a new `NonEmptyReadonlyArray`.
* Produces a couple of a copy of the array without its last element, and that last element.
*
* @exampleTodo
* import { append } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2, 3], append(4)), [1, 2, 3, 4])
*
* @category constructors
* @category getters
* @since 1.0.0
*/
export declare const append: <B>(end: B) => <A>(init: ReadonlyArray<A>) => NonEmptyReadonlyArray<A | B>;
export declare const unappend: <A>(self: readonly [A, ...A[]]) => readonly [readonly A[], A];
/**
* Get the first element of a `ReadonlyArray`, or `None` if the `ReadonlyArray` is empty.
*
* @exampleTodo
* import { head } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(head([1, 2, 3]), some(1))
* assert.deepStrictEqual(head([]), none)
*
* @category getters
* @since 1.0.0

@@ -242,40 +207,44 @@ */

/**
* @category getters
* @since 1.0.0
*/
export declare const headNonEmpty: <A>(self: readonly [A, ...A[]]) => A;
/**
* Get the last element in a `ReadonlyArray`, or `None` if the `ReadonlyArray` is empty.
*
* @exampleTodo
* import { last } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(last([1, 2, 3]), some(3))
* assert.deepStrictEqual(last([]), none)
*
* @category getters
* @since 1.0.0
*/
export declare const last: <A>(as: readonly A[]) => Option<A>;
export declare const last: <A>(self: readonly A[]) => Option<A>;
/**
* @category getters
* @since 1.0.0
*/
export declare const lastNonEmpty: <A>(as: readonly [A, ...A[]]) => A;
/**
* Get all but the first element of a `ReadonlyArray`, creating a new `ReadonlyArray`, or `None` if the `ReadonlyArray` is empty.
*
* @exampleTodo
* import { tail } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(tail([1, 2, 3]), some([2, 3]))
* assert.deepStrictEqual(tail([]), none)
*
* @category getters
* @since 1.0.0
*/
export declare const tail: <A>(as: readonly A[]) => Option<readonly A[]>;
export declare const tail: <A>(self: readonly A[]) => Option<readonly A[]>;
/**
* @category getters
* @since 1.0.0
*/
export declare const tailNonEmpty: <A>(self: readonly [A, ...A[]]) => readonly A[];
/**
* Get all but the last element of a `ReadonlyArray`, creating a new `ReadonlyArray`, or `None` if the `ReadonlyArray` is empty.
*
* @exampleTodo
* import { init } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
* @category getters
* @since 1.0.0
*/
export declare const init: <A>(self: readonly A[]) => Option<readonly A[]>;
/**
* Get all but the last element of a non empty array, creating a new array.
*
* assert.deepStrictEqual(init([1, 2, 3]), some([1, 2]))
* assert.deepStrictEqual(init([]), none)
*
* @category getters
* @since 1.0.0
*/
export declare const init: <A>(as: readonly A[]) => Option<readonly A[]>;
export declare const initNonEmpty: <A>(self: readonly [A, ...A[]]) => readonly A[];
/**

@@ -286,16 +255,6 @@ * Keep only a max number of elements from the start of an `ReadonlyArray`, creating a new `ReadonlyArray`.

*
* @exampleTodo
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const input: ReadonlyArray<number> = [1, 2, 3]
* assert.deepStrictEqual(pipe(input, RA.takeLeft(2)), [1, 2])
*
* // out of bounds
* assert.strictEqual(pipe(input, RA.takeLeft(4)), input)
* assert.strictEqual(pipe(input, RA.takeLeft(-1)), input)
*
* @category getters
* @since 1.0.0
*/
export declare const takeLeft: (n: number) => <A>(as: readonly A[]) => readonly A[];
export declare const take: (n: number) => <A>(self: readonly A[]) => readonly A[];
/**

@@ -306,13 +265,3 @@ * Keep only a max number of elements from the end of an `ReadonlyArray`, creating a new `ReadonlyArray`.

*
* @exampleTodo
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const input: ReadonlyArray<number> = [1, 2, 3]
* assert.deepStrictEqual(pipe(input, RA.takeRight(2)), [2, 3])
*
* // out of bounds
* assert.strictEqual(pipe(input, RA.takeRight(4)), input)
* assert.strictEqual(pipe(input, RA.takeRight(-1)), input)
*
* @category getters
* @since 1.0.0

@@ -324,12 +273,7 @@ */

*
* @exampleTodo
* import { takeLeftWhile } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.deepStrictEqual(takeLeftWhile((n: number) => n % 2 === 0)([2, 4, 3, 6]), [2, 4])
*
* @category getters
* @since 1.0.0
*/
export declare function takeLeftWhile<A, B extends A>(refinement: Refinement<A, B>): (as: ReadonlyArray<A>) => ReadonlyArray<B>;
export declare function takeLeftWhile<A>(predicate: Predicate<A>): <B extends A>(bs: ReadonlyArray<B>) => ReadonlyArray<B>;
export declare function takeLeftWhile<A>(predicate: Predicate<A>): (as: ReadonlyArray<A>) => ReadonlyArray<A>;
export declare function takeWhile<A, B extends A>(refinement: Refinement<A, B>): (self: ReadonlyArray<A>) => ReadonlyArray<B>;
export declare function takeWhile<A>(predicate: Predicate<A>): <B extends A>(self: ReadonlyArray<B>) => ReadonlyArray<B>;
/**

@@ -340,12 +284,8 @@ * Split a `ReadonlyArray` into two parts:

*
* @exampleTodo
* import { spanLeft } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.deepStrictEqual(spanLeft((n: number) => n % 2 === 1)([1, 3, 2, 4, 5]), [[1, 3], [2, 4, 5]])
*
* @category filtering
* @since 1.0.0
*/
export declare function spanLeft<A, B extends A>(refinement: Refinement<A, B>): (as: ReadonlyArray<A>) => readonly [init: ReadonlyArray<B>, rest: ReadonlyArray<A>];
export declare function spanLeft<A>(predicate: Predicate<A>): <B extends A>(bs: ReadonlyArray<B>) => readonly [init: ReadonlyArray<B>, rest: ReadonlyArray<B>];
export declare function spanLeft<A>(predicate: Predicate<A>): (as: ReadonlyArray<A>) => readonly [init: ReadonlyArray<A>, rest: ReadonlyArray<A>];
export declare function span<A, B extends A>(refinement: Refinement<A, B>): (as: ReadonlyArray<A>) => readonly [init: ReadonlyArray<B>, rest: ReadonlyArray<A>];
export declare function span<A>(predicate: Predicate<A>): <B extends A>(bs: ReadonlyArray<B>) => readonly [init: ReadonlyArray<B>, rest: ReadonlyArray<B>];
export declare function span<A>(predicate: Predicate<A>): (as: ReadonlyArray<A>) => readonly [init: ReadonlyArray<A>, rest: ReadonlyArray<A>];
/**

@@ -356,14 +296,6 @@ * Drop a max number of elements from the start of an `ReadonlyArray`, creating a new `ReadonlyArray`.

*
* @exampleTodo
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const input: ReadonlyArray<number> = [1, 2, 3]
* assert.deepStrictEqual(pipe(input, RA.dropLeft(2)), [3])
* assert.strictEqual(pipe(input, RA.dropLeft(0)), input)
* assert.strictEqual(pipe(input, RA.dropLeft(-1)), input)
*
* @category getters
* @since 1.0.0
*/
export declare const dropLeft: (n: number) => <A>(as: readonly A[]) => readonly A[];
export declare const drop: (n: number) => <A>(as: readonly A[]) => readonly A[];
/**

@@ -374,11 +306,3 @@ * Drop a max number of elements from the end of an `ReadonlyArray`, creating a new `ReadonlyArray`.

*
* @exampleTodo
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const input: ReadonlyArray<number> = [1, 2, 3]
* assert.deepStrictEqual(pipe(input, RA.dropRight(2)), [1])
* assert.strictEqual(pipe(input, RA.dropRight(0)), input)
* assert.strictEqual(pipe(input, RA.dropRight(-1)), input)
*
* @category getters
* @since 1.0.0

@@ -390,22 +314,12 @@ */

*
* @exampleTodo
* import { dropLeftWhile } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.deepStrictEqual(dropLeftWhile((n: number) => n % 2 === 1)([1, 3, 2, 4, 5]), [2, 4, 5])
*
* @category getters
* @since 1.0.0
*/
export declare function dropLeftWhile<A, B extends A>(refinement: Refinement<A, B>): (as: ReadonlyArray<A>) => ReadonlyArray<B>;
export declare function dropLeftWhile<A>(predicate: Predicate<A>): <B extends A>(bs: ReadonlyArray<B>) => ReadonlyArray<B>;
export declare function dropLeftWhile<A>(predicate: Predicate<A>): (as: ReadonlyArray<A>) => ReadonlyArray<A>;
export declare function dropWhile<A, B extends A>(refinement: Refinement<A, B>): (as: ReadonlyArray<A>) => ReadonlyArray<B>;
export declare function dropWhile<A>(predicate: Predicate<A>): <B extends A>(bs: ReadonlyArray<B>) => ReadonlyArray<B>;
export declare function dropWhile<A>(predicate: Predicate<A>): (as: ReadonlyArray<A>) => ReadonlyArray<A>;
/**
* Find the first index for which a predicate holds
*
* @exampleTodo
* import { findIndex } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(findIndex((n: number) => n === 2)([1, 2, 3]), some(1))
* assert.deepStrictEqual(findIndex((n: number) => n === 2)([]), none)
*
* @category getters
* @since 1.0.0

@@ -415,10 +329,12 @@ */

/**
* Find the first element which satisfies a predicate (or a refinement) function
* Returns the index of the last element of the list which matches the predicate
*
* @exampleTodo
* import { findFirst } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some } from '@fp-ts/core/typeclass/data/Option'
* @category getters
* @since 1.0.0
*/
export declare const findLastIndex: <A>(predicate: Predicate<A>) => (as: readonly A[]) => Option<number>;
/**
* Find the first element which satisfies a predicate function.
*
* assert.deepStrictEqual(findFirst((x: { a: number, b: number }) => x.a === 1)([{ a: 1, b: 1 }, { a: 1, b: 2 }]), some({ a: 1, b: 1 }))
*
* @category getters
* @since 1.0.0

@@ -430,32 +346,7 @@ */

/**
* Find the first element returned by an option based selector function
* Find the last element which satisfies a predicate function.
*
* @exampleTodo
* import { findFirstMap } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* interface Person {
* name: string
* age?: number
* }
*
* const persons: ReadonlyArray<Person> = [{ name: 'John' }, { name: 'Mary', age: 45 }, { name: 'Joey', age: 28 }]
*
* // returns the name of the first person that has an age
* assert.deepStrictEqual(findFirstMap((p: Person) => (p.age === undefined ? none : some(p.name)))(persons), some('Mary'))
*
* @category getters
* @since 1.0.0
*/
export declare const findFirstMap: <A, B>(f: (a: A) => Option<B>) => (as: readonly A[]) => Option<B>;
/**
* Find the last element which satisfies a predicate function
*
* @exampleTodo
* import { findLast } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(findLast((x: { a: number, b: number }) => x.a === 1)([{ a: 1, b: 1 }, { a: 1, b: 2 }]), some({ a: 1, b: 2 }))
*
* @since 1.0.0
*/
export declare function findLast<A, B extends A>(refinement: Refinement<A, B>): (as: ReadonlyArray<A>) => Option<B>;

@@ -465,64 +356,15 @@ export declare function findLast<A>(predicate: Predicate<A>): <B extends A>(bs: ReadonlyArray<B>) => Option<B>;

/**
* Find the last element returned by an option based selector function
*
* @exampleTodo
* import { findLastMap } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* interface Person {
* name: string
* age?: number
* }
*
* const persons: ReadonlyArray<Person> = [{ name: 'John' }, { name: 'Mary', age: 45 }, { name: 'Joey', age: 28 }]
*
* // returns the name of the last person that has an age
* assert.deepStrictEqual(findLastMap((p: Person) => (p.age === undefined ? none : some(p.name)))(persons), some('Joey'))
*
* @since 1.0.0
*/
export declare const findLastMap: <A, B>(f: (a: A) => Option<B>) => (as: readonly A[]) => Option<B>;
/**
* Returns the index of the last element of the list which matches the predicate
*
* @exampleTodo
* import { findLastIndex } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* interface X {
* a: number
* b: number
* }
* const xs: ReadonlyArray<X> = [{ a: 1, b: 0 }, { a: 1, b: 1 }]
* assert.deepStrictEqual(findLastIndex((x: { a: number }) => x.a === 1)(xs), some(1))
* assert.deepStrictEqual(findLastIndex((x: { a: number }) => x.a === 4)(xs), none)
*
* @since 1.0.0
*/
export declare const findLastIndex: <A>(predicate: Predicate<A>) => (as: readonly A[]) => Option<number>;
/**
* Insert an element at the specified index, creating a new `ReadonlyArray`, or returning `None` if the index is out of bounds.
*
* @exampleTodo
* import { insertAt } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(insertAt(2, 5)([1, 2, 3, 4]), some([1, 2, 5, 3, 4]))
*
* @category mutations
* @since 1.0.0
*/
export declare const insertAt: <A>(i: number, a: A) => (as: readonly A[]) => Option<readonly [A, ...A[]]>;
export declare const insertAt: <B>(i: number, a: B) => <A>(self: readonly A[]) => Option<readonly [B | A, ...(B | A)[]]>;
/**
* Change the element at the specified index, creating a new `ReadonlyArray`, or returning `None` if the index is out of bounds.
*
* @exampleTodo
* import { updateAt } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(updateAt(1, 1)([1, 2, 3]), some([1, 1, 3]))
* assert.deepStrictEqual(updateAt(1, 1)([]), none)
*
* @category mutations
* @since 1.0.0
*/
export declare const updateAt: <A>(i: number, a: A) => (as: readonly A[]) => Option<readonly A[]>;
export declare const updateAt: <B>(i: number, b: B) => <A>(self: readonly A[]) => Option<readonly (B | A)[]>;
/**

@@ -532,193 +374,170 @@ * Apply a function to the element at the specified index, creating a new `ReadonlyArray`, or returning `None` if the index is out

*
* @exampleTodo
* import { modifyAt } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* const double = (x: number): number => x * 2
* assert.deepStrictEqual(modifyAt(1, double)([1, 2, 3]), some([1, 4, 3]))
* assert.deepStrictEqual(modifyAt(1, double)([]), none)
*
* @category mutations
* @since 1.0.0
*/
export declare const modifyAt: <A>(i: number, f: Endomorphism<A>) => (as: readonly A[]) => Option<readonly A[]>;
export declare const modifyAt: <A, B>(i: number, f: (a: A) => B) => (self: readonly A[]) => Option<readonly (A | B)[]>;
/**
* Delete the element at the specified index, creating a new `ReadonlyArray`, or returning `None` if the index is out of bounds.
*
* @exampleTodo
* import { deleteAt } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(deleteAt(0)([1, 2, 3]), some([2, 3]))
* assert.deepStrictEqual(deleteAt(1)([]), none)
*
* @category mutations
* @since 1.0.0
*/
export declare const deleteAt: (i: number) => <A>(as: readonly A[]) => Option<readonly A[]>;
export declare const deleteAt: (i: number) => <A>(self: readonly A[]) => Option<readonly A[]>;
/**
* Reverse a `ReadonlyArray`, creating a new `ReadonlyArray`.
*
* @exampleTodo
* import { reverse } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.deepStrictEqual(reverse([1, 2, 3]), [3, 2, 1])
*
* @category mutations
* @since 1.0.0
*/
export declare const reverse: <A>(as: readonly A[]) => readonly A[];
export declare const reverse: <A>(self: readonly A[]) => readonly A[];
/**
* Extracts from a `ReadonlyArray` of `Either`s all the `Success` elements.
* @since 1.0.0
*/
export declare const reverseNonEmpty: <A>(self: readonly [A, ...A[]]) => readonly [A, ...A[]];
/**
* Extracts from a `ReadonlyArray` of `Either`s all the `Right` elements.
*
* @exampleTodo
* import { rights } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { right, left } from '@fp-ts/core/typeclass/data/Either'
*
* assert.deepStrictEqual(rights([succeed(1), left('foo'), right(2)]), [1, 2])
*
* @category getters
* @since 1.0.0
*/
export declare const rights: <E, A>(as: readonly Either<E, A>[]) => readonly A[];
export declare const rights: <A>(self: readonly Either<unknown, A>[]) => readonly A[];
/**
* Extracts from a `ReadonlyArray` of `Either` all the `Failure` elements. All the `Failure` elements are extracted in order
* Extracts from a `ReadonlyArray` of `Either` all the `Left` elements.
*
* @exampleTodo
* import { lefts } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { left, right } from '@fp-ts/core/typeclass/data/Either'
*
* assert.deepStrictEqual(failures([right(1), left('foo'), right(2)]), ['foo'])
*
* @category getters
* @since 1.0.0
*/
export declare const lefts: <E, A>(as: readonly Either<E, A>[]) => readonly E[];
export declare const lefts: <E>(self: readonly Either<E, unknown>[]) => readonly E[];
/**
* Sort the elements of a `ReadonlyArray` in increasing order, creating a new `ReadonlyArray`.
*
* @exampleTodo
* import { sort } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as N from '@fp-ts/core/typeclass/data/number'
* @category sorting
* @since 1.0.0
*/
export declare const sort: <B>(O: order.Order<B>) => <A extends B>(self: readonly A[]) => readonly A[];
/**
* Sort the elements of a `NonEmptyReadonlyArray` in increasing order, creating a new `NonEmptyReadonlyArray`.
*
* assert.deepStrictEqual(sort(N.Order)([3, 2, 1]), [1, 2, 3])
*
* @category sorting
* @since 1.0.0
*/
export declare const sort: <B>(O: order.Order<B>) => <A extends B>(as: readonly A[]) => readonly A[];
export declare const sortNonEmpty: <B>(O: order.Order<B>) => <A extends B>(self: readonly [A, ...A[]]) => readonly [A, ...A[]];
/**
* Apply a function to pairs of elements at the same index in two `ReadonlyArray`s, collecting the results in a new `ReadonlyArray`. If one
* input `ReadonlyArray` is short, excess elements of the longer `ReadonlyArray` are discarded.
* Sort the elements of a `ReadonlyArray` in increasing order, where elements are compared using first `ords[0]`, then `ords[1]`,
* etc...
*
* @exampleTodo
* import { zipWith } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2, 3], zipWith(['a', 'b', 'c', 'd'], (n, s) => s + n)), ['a1', 'b2', 'c3'])
*
* @category sorting
* @since 1.0.0
*/
export declare const zipWith: <B, A, C>(fb: readonly B[], f: (a: A, b: B) => C) => (fa: readonly A[]) => readonly C[];
export declare const sortBy: <B>(orders: readonly order.Order<B>[]) => <A extends B>(self: readonly A[]) => readonly A[];
/**
* @category sorting
* @since 1.0.0
*/
export declare const sortByNonEmpty: <B>(orders: readonly order.Order<B>[]) => <A extends B>(as: readonly [A, ...A[]]) => readonly [A, ...A[]];
/**
* Takes two `ReadonlyArray`s and returns a `ReadonlyArray` of corresponding pairs. If one input `ReadonlyArray` is short, excess elements of the
* longer `ReadonlyArray` are discarded.
*
* @exampleTodo
* import { zip } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
* @category mutations
* @since 1.0.0
*/
export declare const zip: <B>(that: readonly B[]) => <A>(self: readonly A[]) => readonly (readonly [A, B])[];
/**
* Apply a function to pairs of elements at the same index in two `ReadonlyArray`s, collecting the results in a new `ReadonlyArray`. If one
* input `ReadonlyArray` is short, excess elements of the longer `ReadonlyArray` are discarded.
*
* assert.deepStrictEqual(pipe([1, 2, 3], zip(['a', 'b', 'c', 'd'])), [[1, 'a'], [2, 'b'], [3, 'c']])
*
* @category mutations
* @since 1.0.0
*/
export declare const zip: <B>(bs: ReadonlyArray<B>) => <A>(as: ReadonlyArray<A>) => ReadonlyArray<readonly [A, B]>;
export declare const zipWith: <B, A, C>(that: readonly B[], f: (a: A, b: B) => C) => (self: readonly A[]) => readonly C[];
/**
* @category mutations
* @since 1.0.0
*/
export declare const zipMany: <A>(collection: Iterable<readonly A[]>) => (self: readonly A[]) => readonly (readonly [A, ...A[]])[];
export declare const zipNonEmpty: <B>(that: readonly [B, ...B[]]) => <A>(self: readonly [A, ...A[]]) => readonly [readonly [A, B], ...(readonly [A, B])[]];
/**
* @category mutations
* @since 1.0.0
*/
export declare const zipAll: <A>(collection: Iterable<readonly A[]>) => readonly (readonly A[])[];
export declare const zipNonEmptyWith: <B, A, C>(that: readonly [B, ...B[]], f: (a: A, b: B) => C) => (self: readonly [A, ...A[]]) => readonly [C, ...C[]];
/**
* This function is the inverse of `zip`. Takes a `ReadonlyArray` of pairs and return two corresponding `ReadonlyArray`s.
*
* @exampleTodo
* import { unzip } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.deepStrictEqual(unzip([[1, 'a'], [2, 'b'], [3, 'c']]), [[1, 2, 3], ['a', 'b', 'c']])
*
* @category mutations
* @since 1.0.0
*/
export declare const unzip: <A, B>(as: readonly (readonly [A, B])[]) => readonly [readonly A[], readonly B[]];
export declare const unzip: <A, B>(self: readonly (readonly [A, B])[]) => readonly [readonly A[], readonly B[]];
/**
* @category mutations
* @since 1.0.0
*/
export declare const product: <B>(that: readonly B[]) => <A>(self: readonly A[]) => readonly (readonly [A, B])[];
export declare const unzipNonEmpty: <A, B>(self: readonly [readonly [A, B], ...(readonly [A, B])[]]) => readonly [readonly [A, ...A[]], readonly [B, ...B[]]];
/**
* Places an element in between members of a `ReadonlyArray`
*
* @category mutations
* @since 1.0.0
*/
export declare const cross: <B>(fb: readonly B[]) => <A>(fa: readonly A[]) => readonly (readonly [A, B])[];
export declare const intersperse: <B>(middle: B) => <A>(self: readonly A[]) => readonly (B | A)[];
/**
* Places an element in between members of a `NonEmptyReadonlyArray`
*
* @category mutations
* @since 1.0.0
*/
export declare const productMany: <A>(collection: Iterable<readonly A[]>) => (self: readonly A[]) => readonly (readonly [A, ...A[]])[];
export declare const intersperseNonEmpty: <B>(middle: B) => <A>(self: readonly [A, ...A[]]) => readonly [B | A, ...(B | A)[]];
/**
* Apply a function to the head, creating a new `NonEmptyReadonlyArray`.
*
* @category mutations
* @since 1.0.0
*/
export declare const productAll: <A>(collection: Iterable<readonly A[]>) => readonly (readonly A[])[];
export declare const modifyNonEmptyHead: <A, B>(f: (a: A) => B) => (self: readonly [A, ...A[]]) => readonly [A | B, ...(A | B)[]];
/**
* Prepend an element to every member of a `ReadonlyArray`
* Change the head, creating a new `NonEmptyReadonlyArray`.
*
* @exampleTodo
* import { prependAll } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
* @category mutations
* @since 1.0.0
*/
export declare const updateNonEmptyHead: <B>(b: B) => <A>(self: readonly [A, ...A[]]) => readonly [B | A, ...(B | A)[]];
/**
* Apply a function to the last element, creating a new `NonEmptyReadonlyArray`.
*
* assert.deepStrictEqual(pipe([1, 2, 3, 4], prependAll(9)), [9, 1, 9, 2, 9, 3, 9, 4])
*
* @category mutations
* @since 1.0.0
*/
export declare const prependAll: <A>(middle: A) => (as: readonly A[]) => readonly A[];
export declare const modifyNonEmptyLast: <A, B>(f: (a: A) => B) => (self: readonly [A, ...A[]]) => readonly [A | B, ...(A | B)[]];
/**
* Places an element in between members of a `ReadonlyArray`
* Change the last element, creating a new `NonEmptyReadonlyArray`.
*
* @exampleTodo
* import { intersperse } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2, 3, 4], intersperse(9)), [1, 9, 2, 9, 3, 9, 4])
*
* @category mutations
* @since 1.0.0
*/
export declare const intersperse: <A>(middle: A) => (as: readonly A[]) => readonly A[];
export declare const updateNonEmptyLast: <B>(b: B) => <A>(self: readonly [A, ...A[]]) => readonly [B | A, ...(B | A)[]];
/**
* Rotate a `ReadonlyArray` by `n` steps.
*
* @exampleTodo
* import { rotate } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* @category mutations
* @since 1.0.0
*/
export declare const rotate: (n: number) => <A>(self: readonly A[]) => readonly A[];
/**
* Rotate a `NonEmptyReadonlyArray` by `n` steps.
*
* assert.deepStrictEqual(rotate(2)([1, 2, 3, 4, 5]), [4, 5, 1, 2, 3])
* assert.deepStrictEqual(rotate(-2)([1, 2, 3, 4, 5]), [3, 4, 5, 1, 2])
*
* @category mutations
* @since 1.0.0
*/
export declare const rotate: (n: number) => <A>(as: readonly A[]) => readonly A[];
export declare const rotateNonEmpty: (n: number) => <A>(self: readonly [A, ...A[]]) => readonly [A, ...A[]];
/**
* Tests whether a value is a member of a `ReadonlyArray`.
*
* @exampleTodo
* import { elem } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as N from '@fp-ts/core/typeclass/data/number'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.strictEqual(pipe([1, 2, 3], elem(N.Eq)(2)), true)
* assert.strictEqual(pipe([1, 2, 3], elem(N.Eq)(0)), false)
*
* @category predicates
* @since 1.0.0
*/
export declare const elem: <B>(a: B) => <A>(as: readonly A[]) => boolean;
export declare const elem: <B>(b: B) => <A>(self: readonly A[]) => boolean;
/**
* Remove duplicates from a `ReadonlyArray`, keeping the first occurrence of an element.
*
* @exampleTodo
* import { uniq } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as N from '@fp-ts/core/typeclass/data/number'
*
* assert.deepStrictEqual(uniq(N.Eq)([1, 2, 1]), [1, 2])
*
* @category mutations
* @since 1.0.0

@@ -728,32 +547,8 @@ */

/**
* Sort the elements of a `ReadonlyArray` in increasing order, where elements are compared using first `ords[0]`, then `ords[1]`,
* etc...
* Remove duplicates from a `NonEmptyReadonlyArray`, keeping the first occurrence of an element.
*
* @exampleTodo
* import { sortBy } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { contramap } from '@fp-ts/core/typeclass/Order'
* import * as S from '@fp-ts/core/typeclass/data/string'
* import * as N from '@fp-ts/core/typeclass/data/number'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* interface Person {
* name: string
* age: number
* }
* const byName = pipe(S.Order, contramap((p: Person) => p.name))
* const byAge = pipe(N.Order, contramap((p: Person) => p.age))
*
* const sortByNameByAge = sortBy([byName, byAge])
*
* const persons = [{ name: 'a', age: 1 }, { name: 'b', age: 3 }, { name: 'c', age: 2 }, { name: 'b', age: 2 }]
* assert.deepStrictEqual(sortByNameByAge(persons), [
* { name: 'a', age: 1 },
* { name: 'b', age: 2 },
* { name: 'b', age: 3 },
* { name: 'c', age: 2 }
* ])
*
* @category mutations
* @since 1.0.0
*/
export declare const sortBy: <B>(orders: readonly order.Order<B>[]) => <A extends B>(as: readonly A[]) => readonly A[];
export declare const uniqNonEmpty: <A>(self: readonly [A, ...A[]]) => readonly [A, ...A[]];
/**

@@ -764,27 +559,27 @@ * A useful recursion pattern for processing a `ReadonlyArray` to produce a new `ReadonlyArray`, often used for "chopping" up the input

*
* @exampleTodo
* import { Eq } from '@fp-ts/core/typeclass/typeclasses/Eq'
* import * as N from '@fp-ts/core/typeclass/data/number'
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
* @since 1.0.0
*/
export declare const chop: <A, B>(f: (as: readonly [A, ...A[]]) => readonly [B, readonly A[]]) => (self: readonly A[]) => readonly B[];
/**
* A useful recursion pattern for processing a `NonEmptyReadonlyArray` to produce a new `NonEmptyReadonlyArray`, often used for "chopping" up the input
* `NonEmptyReadonlyArray`. Typically `chop` is called with some function that will consume an initial prefix of the `NonEmptyReadonlyArray` and produce a
* value and the tail of the `NonEmptyReadonlyArray`.
*
* const group = <A>(E: Eq<A>): ((as: ReadonlyArray<A>) => ReadonlyArray<ReadonlyArray<A>>) => {
* return RA.chop(as => pipe(as, RA.spanLeft(E.equals(as[0]))))
* }
* assert.deepStrictEqual(group(N.Eq)([1, 1, 2, 3, 3, 4]), [[1, 1], [2], [3, 3], [4]])
*
* @since 1.0.0
*/
export declare const chop: <A, B>(f: (as: readonly [A, ...A[]]) => readonly [B, readonly A[]]) => (as: readonly A[]) => readonly B[];
export declare const chopNonEmpty: <A, B>(f: (as: readonly [A, ...A[]]) => readonly [B, readonly A[]]) => (self: readonly [A, ...A[]]) => readonly [B, ...B[]];
/**
* Splits a `ReadonlyArray` into two pieces, the first piece has max `n` elements.
*
* @exampleTodo
* import { splitAt } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* @category getters
* @since 1.0.0
*/
export declare const splitAt: (n: number) => <A>(self: readonly A[]) => readonly [readonly A[], readonly A[]];
/**
* Splits a `NonEmptyReadonlyArray` into two pieces, the first piece has max `n` elements.
*
* assert.deepStrictEqual(splitAt(2)([1, 2, 3, 4, 5]), [[1, 2], [3, 4, 5]])
*
* @category getters
* @since 1.0.0
*/
export declare const splitAt: (n: number) => <A>(as: readonly A[]) => readonly [readonly A[], readonly A[]];
export declare const splitNonEmptyAt: (n: number) => <A>(self: readonly [A, ...A[]]) => readonly [readonly [A, ...A[]], readonly A[]];
/**

@@ -801,34 +596,45 @@ * Splits a `ReadonlyArray` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of

*
* @exampleTodo
* import { chunksOf } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* @category getters
* @since 1.0.0
*/
export declare const chunksOf: (n: number) => <A>(self: readonly A[]) => readonly (readonly [A, ...A[]])[];
/**
* Splits a `NonEmptyReadonlyArray` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of
* the `NonEmptyReadonlyArray`.
*
* assert.deepStrictEqual(chunksOf(2)([1, 2, 3, 4, 5]), [[1, 2], [3, 4], [5]])
* @category getters
* @since 1.0.0
*/
export declare const chunksOfNonEmpty: (n: number) => <A>(self: readonly [A, ...A[]]) => readonly [readonly [A, ...A[]], ...(readonly [A, ...A[]])[]];
/**
* Group equal, consecutive elements of a `NonEmptyReadonlyArray` into `NonEmptyReadonlyArray`s.
*
* @category grouping
* @since 1.0.0
*/
export declare const chunksOf: (n: number) => <A>(as: readonly A[]) => readonly (readonly [A, ...A[]])[];
export declare const group: <A>(self: readonly [A, ...A[]]) => readonly [readonly [A, ...A[]], ...(readonly [A, ...A[]])[]];
/**
* Creates a `ReadonlyArray` of unique values, in order, from all given `ReadonlyArray`s using a `Eq` for equality comparisons.
* Splits an array into sub-non-empty-arrays stored in an object, based on the result of calling a `string`-returning
* function on each element, and grouping the results according to values returned
*
* @exampleTodo
* import { union } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as N from '@fp-ts/core/typeclass/data/number'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2], union(N.Eq)([2, 3])), [1, 2, 3])
*
* @category grouping
* @since 1.0.0
*/
export declare const union: <B>(that: readonly B[]) => <A>(self: readonly A[]) => readonly B[] | readonly [B | A, ...(B | A)[]];
export declare const groupBy: <A>(f: (a: A) => string) => (self: readonly A[]) => Readonly<Record<string, readonly [A, ...A[]]>>;
/**
* @category mutations
* @since 1.0.0
*/
export declare const union: <B>(that: readonly B[]) => <A>(self: readonly A[]) => readonly (B | A)[];
/**
* @category mutations
* @since 1.0.0
*/
export declare function unionNonEmpty<B>(that: NonEmptyReadonlyArray<B>): <A>(self: ReadonlyArray<A>) => NonEmptyReadonlyArray<A | B>;
export declare function unionNonEmpty<B>(that: ReadonlyArray<B>): <A>(self: NonEmptyReadonlyArray<A>) => NonEmptyReadonlyArray<A | B>;
/**
* Creates a `ReadonlyArray` of unique values that are included in all given `ReadonlyArray`s using a `Eq` for equality
* comparisons. The order and references of result values are determined by the first `ReadonlyArray`.
*
* @exampleTodo
* import { intersection } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as N from '@fp-ts/core/typeclass/data/number'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2], intersection(N.Eq)([2, 3])), [2])
*
* @category mutations
* @since 1.0.0

@@ -841,9 +647,3 @@ */

*
* @exampleTodo
* import { difference } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as N from '@fp-ts/core/typeclass/data/number'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2], difference(N.Eq)([2, 3])), [1])
*
* @category mutations
* @since 1.0.0

@@ -856,4 +656,5 @@ */

*/
export declare const of: <A>(a: A) => ReadonlyArray<A>;
export declare const of: <A>(a: A) => readonly [A, ...A[]];
/**
* @category constructors
* @since 1.0.0

@@ -863,30 +664,22 @@ */

/**
* Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to
* types of kind `* -> *`.
*
* In case of `ReadonlyArray` concatenates the inputs into a single array.
*
* @exampleTodo
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(
* pipe(
* [1, 2, 3],
* RA.orElse([4, 5])
* ),
* [1, 2, 3, 4, 5]
* )
*
* @category mapping
* @since 1.0.0
*/
export declare const orElse: <B>(that: readonly B[]) => <A>(self: readonly A[]) => readonly (B | A)[];
export declare const map: <A, B>(f: (a: A) => B) => (self: readonly A[]) => readonly B[];
/**
* Returns an effect whose success is mapped by the specified `f` function.
*
* @category mapping
* @since 1.0.0
*/
export declare const map: <A, B>(f: (a: A) => B) => (fa: readonly A[]) => readonly B[];
export declare const mapNonEmpty: <A, B>(f: (a: A) => B) => (self: readonly [A, ...A[]]) => readonly [B, ...B[]];
/**
* @category mapping
* @since 1.0.0
*/
export declare const mapWithIndex: <A, B>(f: (a: A, i: number) => B) => (self: readonly A[]) => readonly B[];
/**
* @category mapping
* @since 1.0.0
*/
export declare const mapNonEmptyWithIndex: <A, B>(f: (a: A, i: number) => B) => (self: readonly [A, ...A[]]) => readonly [B, ...B[]];
/**
* @category instances

@@ -897,4 +690,10 @@ * @since 1.0.0

/**
* @category do notation
* @since 1.0.0
*/
export declare const Do: ReadonlyArray<{}>;
/**
* @category mapping
* @since 1.0.0
*/
export declare const imap: <A, B>(to: (a: A) => B, from: (b: B) => A) => (self: ReadonlyArray<A>) => ReadonlyArray<B>;

@@ -907,5 +706,10 @@ /**

/**
* @category instances
* @since 1.0.0
*/
export declare const tupled: <A>(self: ReadonlyArray<A>) => ReadonlyArray<readonly [A]>;
export declare const Covariant: covariant.Covariant<ReadonlyArrayTypeLambda>;
declare const let_: <N extends string, A extends object, B>(name: Exclude<N, keyof A>, f: (a: A) => B) => (self: ReadonlyArray<A>) => ReadonlyArray<{
readonly [K in N | keyof A]: K extends keyof A ? A[K] : B;
}>;
export {
/**

@@ -915,12 +719,10 @@ * @category do notation

*/
export declare const bindTo: <N extends string>(name: N) => <A>(self: ReadonlyArray<A>) => ReadonlyArray<{
readonly [K in N]: A;
}>;
let_ as let };
/**
* @category instances
* @category mapping
* @since 1.0.0
*/
export declare const Covariant: covariant.Covariant<ReadonlyArrayTypeLambda>;
export declare const flap: <A>(a: A) => <B>(fab: ReadonlyArray<(a: A) => B>) => ReadonlyArray<B>;
/**
* Returns the effect resulting from mapping the success of this effect to unit.
* Maps the success value of this effect to the specified constant value.
*

@@ -930,3 +732,3 @@ * @category mapping

*/
export declare const asUnit: <_>(self: ReadonlyArray<_>) => ReadonlyArray<void>;
export declare const as: <B>(b: B) => (self: ReadonlyArray<unknown>) => ReadonlyArray<B>;
/**

@@ -938,26 +740,22 @@ * @category instances

/**
* @exampleTodo
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(
* pipe(
* [1, 2, 3],
* RA.flatMap((n) => [`a${n}`, `b${n}`])
* ),
* ['a1', 'b1', 'a2', 'b2', 'a3', 'b3']
* )
* assert.deepStrictEqual(
* pipe(
* [1, 2, 3],
* RA.flatMap(() => [])
* ),
* []
* )
*
* @category sequencing
* @since 1.0.0
*/
export declare const flatMapWithIndex: <A, B>(f: (a: A, i: number) => readonly B[]) => (self: readonly A[]) => readonly B[];
/**
* @category sequencing
* @since 1.0.0
*/
export declare const flatMap: <A, B>(f: (a: A) => ReadonlyArray<B>) => (self: ReadonlyArray<A>) => ReadonlyArray<B>;
/**
* @category sequencing
* @since 1.0.0
*/
export declare const flatMapNonEmptyWithIndex: <A, B>(f: (a: A, i: number) => readonly [B, ...B[]]) => (self: readonly [A, ...A[]]) => readonly [B, ...B[]];
/**
* @category sequencing
* @since 1.0.0
*/
export declare const flatMapNonEmpty: <A, B>(f: (a: A) => NonEmptyReadonlyArray<B>) => (self: NonEmptyReadonlyArray<A>) => NonEmptyReadonlyArray<B>;
/**
* @category instances

@@ -968,8 +766,14 @@ * @since 1.0.0

/**
* @category sequencing
* @since 1.0.0
*/
export declare const andThen: <B>(that: ReadonlyArray<B>) => <_>(self: ReadonlyArray<_>) => ReadonlyArray<B>;
export declare const flatten: <A>(self: ReadonlyArray<ReadonlyArray<A>>) => ReadonlyArray<A>;
/**
* @category sequencing
* @since 1.0.0
*/
export declare const flattenNonEmpty: <A>(self: NonEmptyReadonlyArray<NonEmptyReadonlyArray<A>>) => NonEmptyReadonlyArray<A>;
/**
* @since 1.0.0
*/
export declare const composeKleisliArrow: <B, C>(bfc: (b: B) => ReadonlyArray<C>) => <A>(afb: (a: A) => ReadonlyArray<B>) => (a: A) => ReadonlyArray<C>;

@@ -982,10 +786,2 @@ /**

/**
* Sequences the specified effect after this effect, but ignores the value
* produced by the effect.
*
* @category sequencing
* @since 1.0.0
*/
export declare const andThenDiscard: <_>(that: ReadonlyArray<_>) => <A>(self: ReadonlyArray<A>) => ReadonlyArray<A>;
/**
* @category do notation

@@ -998,24 +794,21 @@ * @since 1.0.0

/**
* @category filtering
* @since 1.0.0
*/
export declare const ap: <A>(fa: ReadonlyArray<A>) => <B>(self: ReadonlyArray<(a: A) => B>) => ReadonlyArray<B>;
export declare const filterMapWithIndex: <A, B>(f: (a: A, i: number) => Option<B>) => (self: Iterable<A>) => readonly B[];
/**
* @category filtering
* @since 1.0.0
*/
export declare const flatMapWithIndex: <A, B>(f: (i: number, a: A) => readonly B[]) => (as: readonly A[]) => readonly B[];
export declare const filterMap: <A, B>(f: (a: A) => Option<B>) => (self: Iterable<A>) => ReadonlyArray<B>;
/**
* Removes one level of nesting
*
* @exampleTodo
* import { flatten } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.deepStrictEqual(flatten([[1], [2, 3], [4]]), [1, 2, 3, 4])
*
* @category filtering
* @since 1.0.0
*/
export declare const flatten: <A>(mma: ReadonlyArray<ReadonlyArray<A>>) => ReadonlyArray<A>;
export declare const compact: <A>(self: ReadonlyArray<Option<A>>) => ReadonlyArray<A>;
/**
* @category instances
* @since 1.0.0
*/
export declare const mapWithIndex: <A, B>(f: (a: A, i: number) => B) => (self: readonly A[]) => readonly B[];
export declare const Compactable: compactable.Compactable<ReadonlyArrayTypeLambda>;
/**

@@ -1025,8 +818,16 @@ * @category filtering

*/
export declare const filterMapWithIndex: <A, B>(f: (i: number, a: A) => Option<B>) => (self: Iterable<A>) => readonly B[];
export declare const separate: <A, B>(fe: ReadonlyArray<Either<A, B>>) => readonly [ReadonlyArray<A>, ReadonlyArray<B>];
/**
* @category instances
* @since 1.0.0
*/
export declare const Filterable: filterable.Filterable<ReadonlyArrayTypeLambda>;
/**
* @category filtering
* @since 1.0.0
*/
export declare const filterMap: <A, B>(f: (a: A) => Option<B>) => (self: Iterable<A>) => ReadonlyArray<B>;
export declare const filter: {
<C extends A, B extends A, A = C>(refinement: Refinement<A, B>): (self: ReadonlyArray<C>) => ReadonlyArray<B>;
<B extends A, A = B>(predicate: Predicate<A>): (self: ReadonlyArray<B>) => ReadonlyArray<B>;
};
/**

@@ -1036,3 +837,6 @@ * @category filtering

*/
export declare const compact: <A>(foa: ReadonlyArray<Option<A>>) => ReadonlyArray<A>;
export declare const filterWithIndex: {
<C extends A, B extends A, A = C>(refinement: (a: A, i: number) => a is B): (fc: ReadonlyArray<C>) => ReadonlyArray<B>;
<B extends A, A = B>(predicate: (a: A, i: number) => boolean): (fb: ReadonlyArray<B>) => ReadonlyArray<B>;
};
/**

@@ -1042,3 +846,6 @@ * @category filtering

*/
export declare const separate: <A, B>(fe: ReadonlyArray<Either<A, B>>) => readonly [ReadonlyArray<A>, ReadonlyArray<B>];
export declare const partition: {
<C extends A, B extends A, A = C>(refinement: Refinement<A, B>): (self: ReadonlyArray<C>) => readonly [ReadonlyArray<C>, ReadonlyArray<B>];
<B extends A, A = B>(predicate: Predicate<A>): (self: ReadonlyArray<B>) => readonly [ReadonlyArray<B>, ReadonlyArray<B>];
};
/**

@@ -1048,3 +855,6 @@ * @category filtering

*/
export declare const partitionMap: <A, B, C>(f: (a: A) => Either<B, C>) => (fa: ReadonlyArray<A>) => readonly [ReadonlyArray<B>, ReadonlyArray<C>];
export declare const partitionWithIndex: {
<C extends A, B extends A, A = C>(refinement: (a: A, i: number) => a is B): (fb: ReadonlyArray<C>) => readonly [ReadonlyArray<C>, ReadonlyArray<B>];
<B extends A, A = B>(predicate: (a: A, i: number) => boolean): (fb: ReadonlyArray<B>) => readonly [ReadonlyArray<B>, ReadonlyArray<B>];
};
/**

@@ -1054,7 +864,8 @@ * @category filtering

*/
export declare const partitionMapWithIndex: <A, B, C>(f: (i: number, a: A) => Either<B, C>) => (fa: readonly A[]) => readonly [readonly B[], readonly C[]];
export declare const partitionMap: <A, B, C>(f: (a: A) => Either<B, C>) => (self: ReadonlyArray<A>) => readonly [ReadonlyArray<B>, ReadonlyArray<C>];
/**
* @category filtering
* @since 1.0.0
*/
export declare const extend: <A, B>(f: (fa: ReadonlyArray<A>) => B) => (self: ReadonlyArray<A>) => ReadonlyArray<B>;
export declare const partitionMapWithIndex: <A, B, C>(f: (a: A, i: number) => Either<B, C>) => (fa: readonly A[]) => readonly [readonly B[], readonly C[]];
/**

@@ -1064,3 +875,3 @@ * @category traversing

*/
export declare const traverseWithIndex: <F extends TypeLambda>(F: applicative.Applicative<F>) => <A, R, O, E, B>(f: (a: A, i: number) => Kind<F, R, O, E, B>) => (self: readonly A[]) => Kind<F, R, O, E, readonly B[]>;
export declare const traverse: <F extends TypeLambda>(F: applicative.Applicative<F>) => <A, R, O, E, B>(f: (a: A) => Kind<F, R, O, E, B>) => (self: readonly A[]) => Kind<F, R, O, E, readonly B[]>;
/**

@@ -1070,17 +881,18 @@ * @category traversing

*/
export declare const traverse: <F extends TypeLambda>(F: applicative.Applicative<F>) => <A, R, O, E, B>(f: (a: A) => Kind<F, R, O, E, B>) => (self: readonly A[]) => Kind<F, R, O, E, readonly B[]>;
export declare const traverseWithIndex: <F extends TypeLambda>(F: applicative.Applicative<F>) => <A, R, O, E, B>(f: (a: A, i: number) => Kind<F, R, O, E, B>) => (self: readonly A[]) => Kind<F, R, O, E, readonly B[]>;
/**
* @category traversing
* @since 1.0.0
*/
export declare const unfold: <B, A>(b: B, f: (b: B) => Option<readonly [A, B]>) => ReadonlyArray<A>;
export declare const traverseNonEmpty: <F extends TypeLambda>(F: nonEmptyApplicative.NonEmptyApplicative<F>) => <A, R, O, E, B>(f: (a: A) => Kind<F, R, O, E, B>) => (self: readonly [A, ...A[]]) => Kind<F, R, O, E, readonly [B, ...B[]]>;
/**
* @category instances
* @category traversing
* @since 1.0.0
*/
export declare const getUnionSemigroup: <A>() => Semigroup<readonly A[]>;
export declare const traverseNonEmptyWithIndex: <F extends TypeLambda>(F: nonEmptyApplicative.NonEmptyApplicative<F>) => <A, R, O, E, B>(f: (a: A, i: number) => Kind<F, R, O, E, B>) => (self: readonly [A, ...A[]]) => Kind<F, R, O, E, readonly [B, ...B[]]>;
/**
* @category instances
* @category traversing
* @since 1.0.0
*/
export declare const getUnionMonoid: <A>() => Monoid<readonly A[]>;
export declare const sequence: <F extends TypeLambda>(F: applicative.Applicative<F>) => <R, O, E, A>(self: ReadonlyArray<Kind<F, R, O, E, A>>) => Kind<F, R, O, E, ReadonlyArray<A>>;
/**

@@ -1090,56 +902,25 @@ * @category instances

*/
export declare const getIntersectionSemigroup: <A>() => Semigroup<readonly A[]>;
export declare const Traversable: traversable.Traversable<ReadonlyArrayTypeLambda>;
/**
* Returns a `Semigroup` for `ReadonlyArray<A>`.
*
* @exampleTodo
* import { getSemigroup } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const S = getSemigroup<number>()
* assert.deepStrictEqual(pipe([1, 2], S.combine([3, 4])), [1, 2, 3, 4])
*
* @category instances
* @category traversing
* @since 1.0.0
*/
export declare const getSemigroup: <A>() => Semigroup<readonly A[]>;
export declare const traverseTap: <F extends TypeLambda>(F: applicative.Applicative<F>) => <A, R, O, E, B>(f: (a: A) => Kind<F, R, O, E, B>) => (self: ReadonlyArray<A>) => Kind<F, R, O, E, ReadonlyArray<A>>;
/**
* Returns a `Monoid` for `ReadonlyArray<A>`.
*
* @category instances
* @category traversing
* @since 1.0.0
*/
export declare const getMonoid: <A>() => Monoid<readonly A[]>;
export declare const sequenceNonEmpty: <F extends TypeLambda>(F: nonEmptyApplicative.NonEmptyApplicative<F>) => <R, O, E, A>(self: readonly [Kind<F, R, O, E, A>, ...Kind<F, R, O, E, A>[]]) => Kind<F, R, O, E, readonly [A, ...A[]]>;
/**
* Derives an `Order` over the `ReadonlyArray` of a given element type from the `Order` of that type. The ordering between two such
* `ReadonlyArray`s is equal to: the first non equal comparison of each `ReadonlyArray`s elements taken pairwise in increasing order, in
* case of equality over all the pairwise elements; the longest `ReadonlyArray` is considered the greatest, if both `ReadonlyArray`s have
* the same length, the result is equality.
*
* @exampleTodo
* import { liftOrder } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as S from '@fp-ts/core/typeclass/data/string'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const O = liftOrder(S.Order)
* assert.strictEqual(pipe(['b'], O.compare(['a'])), 1)
* assert.strictEqual(pipe(['a'], O.compare(['a'])), 0)
* assert.strictEqual(pipe(['a'], O.compare(['b'])), -1)
*
* @category instances
* @since 1.0.0
*/
export declare const liftOrder: <A>(O: order.Order<A>) => order.Order<readonly A[]>;
export declare const product: <B>(that: readonly B[]) => <A>(self: readonly A[]) => readonly (readonly [A, B])[];
/**
* @category mapping
* @since 1.0.0
*/
export declare const flap: <A>(a: A) => <B>(fab: ReadonlyArray<(a: A) => B>) => ReadonlyArray<B>;
export declare const productMany: <A>(collection: Iterable<ReadonlyArray<A>>) => (self: ReadonlyArray<A>) => ReadonlyArray<NonEmptyReadonlyArray<A>>;
/**
* Maps the success value of this effect to the specified constant value.
*
* @category mapping
* @since 1.0.0
*/
export declare const as: <B>(b: B) => (self: ReadonlyArray<unknown>) => ReadonlyArray<B>;
export declare const productAll: <A>(collection: Iterable<readonly A[]>) => readonly (readonly A[])[];
/**

@@ -1151,2 +932,11 @@ * @category instances

/**
* A variant of `bind` that sequentially ignores the scope.
*
* @category do notation
* @since 1.0.0
*/
export declare const bindReadonlyArray: <N extends string, A extends object, B>(name: Exclude<N, keyof A>, fb: ReadonlyArray<B>) => (self: ReadonlyArray<A>) => ReadonlyArray<{
readonly [K in N | keyof A]: K extends keyof A ? A[K] : B;
}>;
/**
* @category instances

@@ -1157,2 +947,6 @@ * @since 1.0.0

/**
* @since 1.0.0
*/
export declare const ap: <A>(fa: ReadonlyArray<A>) => <B>(self: ReadonlyArray<(a: A) => B>) => ReadonlyArray<B>;
/**
* Lifts a binary function into `ReadonlyArray`.

@@ -1172,2 +966,3 @@ *

/**
* @category lifting
* @since 1.0.0

@@ -1187,2 +982,3 @@ */

/**
* @category lifting
* @since 1.0.0

@@ -1197,73 +993,16 @@ */

/**
* Returns an effect that effectfully "peeks" at the success of this effect.
*
* @exampleTodo
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(
* pipe(
* [1, 2, 3],
* RA.tap(() => ['a', 'b'])
* ),
* [1, 1, 2, 2, 3, 3]
* )
* assert.deepStrictEqual(
* pipe(
* [1, 2, 3],
* RA.tap(() => [])
* ),
* []
* )
*
* @category folding
* @since 1.0.0
*/
export declare const tap: <A, _>(f: (a: A) => ReadonlyArray<_>) => (self: ReadonlyArray<A>) => ReadonlyArray<A>;
export declare const reduce: <B, A>(b: B, f: (b: B, a: A) => B) => (self: readonly A[]) => B;
/**
* @category instances
* @category folding
* @since 1.0.0
*/
export declare const Compactable: compactable.Compactable<ReadonlyArrayTypeLambda>;
export declare const reduceWithIndex: <B, A>(b: B, f: (b: B, a: A, i: number) => B) => (self: readonly A[]) => B;
/**
* @category instances
* @since 1.0.0
*/
export declare const Filterable: filterable.Filterable<ReadonlyArrayTypeLambda>;
/**
* @category filtering
* @since 1.0.0
*/
export declare const filter: {
<C extends A, B extends A, A = C>(refinement: Refinement<A, B>): (fc: ReadonlyArray<C>) => ReadonlyArray<B>;
<B extends A, A = B>(predicate: Predicate<A>): (fb: ReadonlyArray<B>) => ReadonlyArray<B>;
};
/**
* @category filtering
* @since 1.0.0
*/
export declare const partition: {
<C extends A, B extends A, A = C>(refinement: Refinement<A, B>): (fc: ReadonlyArray<C>) => readonly [ReadonlyArray<C>, ReadonlyArray<B>];
<B extends A, A = B>(predicate: Predicate<A>): (fb: ReadonlyArray<B>) => readonly [ReadonlyArray<B>, ReadonlyArray<B>];
};
/**
* @category filtering
* @since 1.0.0
*/
export declare const filterWithIndex: {
<C extends A, B extends A, A = C>(refinement: (i: number, a: A) => a is B): (fc: ReadonlyArray<C>) => ReadonlyArray<B>;
<B extends A, A = B>(predicate: (i: number, a: A) => boolean): (fb: ReadonlyArray<B>) => ReadonlyArray<B>;
};
/**
* @category filtering
* @since 1.0.0
*/
export declare const partitionWithIndex: {
<C extends A, B extends A, A = C>(refinement: (i: number, a: A) => a is B): (fb: ReadonlyArray<C>) => readonly [ReadonlyArray<C>, ReadonlyArray<B>];
<B extends A, A = B>(predicate: (i: number, a: A) => boolean): (fb: ReadonlyArray<B>) => readonly [ReadonlyArray<B>, ReadonlyArray<B>];
};
/**
* @category folding
* @since 1.0.0
*/
export declare const reduce: <B, A>(b: B, f: (b: B, a: A) => B) => (self: readonly A[]) => B;
export declare const reduceRight: <B, A>(b: B, f: (b: B, a: A) => B) => (self: readonly A[]) => B;
/**

@@ -1273,3 +1012,3 @@ * @category folding

*/
export declare const reduceRight: <B, A>(b: B, f: (b: B, a: A) => B) => (self: readonly A[]) => B;
export declare const reduceRightWithIndex: <B, A>(b: B, f: (b: B, a: A, i: number) => B) => (self: readonly A[]) => B;
/**

@@ -1289,3 +1028,3 @@ * @category instances

*/
export declare const reduceKind: <G extends TypeLambda>(G: monad.Monad<G>) => <B, A, R, O, E>(b: B, f: (b: B, a: A) => Kind<G, R, O, E, B>) => (self: ReadonlyArray<A>) => Kind<G, R, O, E, B>;
export declare const foldMapWithIndex: <M>(Monoid: Monoid<M>) => <A>(f: (a: A, i: number) => M) => (self: readonly A[]) => M;
/**

@@ -1295,3 +1034,3 @@ * @category folding

*/
export declare const reduceRightKind: <G extends TypeLambda>(G: monad.Monad<G>) => <B, A, R, O, E>(b: B, f: (b: B, a: A) => Kind<G, R, O, E, B>) => (self: ReadonlyArray<A>) => Kind<G, R, O, E, B>;
export declare const foldMapNonEmpty: <S>(S: Semigroup<S>) => <A>(f: (a: A) => S) => (self: readonly [A, ...A[]]) => S;
/**

@@ -1301,3 +1040,3 @@ * @category folding

*/
export declare const foldMapKind: <G extends TypeLambda>(G: Coproduct<G>) => <A, R, O, E, B>(f: (a: A) => Kind<G, R, O, E, B>) => (self: ReadonlyArray<A>) => Kind<G, R, O, E, B>;
export declare const foldMapNonEmptyWithIndex: <S>(S: Semigroup<S>) => <A>(f: (a: A, i: number) => S) => (self: readonly [A, ...A[]]) => S;
/**

@@ -1307,3 +1046,3 @@ * @category folding

*/
export declare const reduceWithIndex: <B, A>(b: B, f: (i: number, b: B, a: A) => B) => (self: readonly A[]) => B;
export declare const reduceKind: <F extends TypeLambda>(F: monad.Monad<F>) => <B, A, R, O, E>(b: B, f: (b: B, a: A) => Kind<F, R, O, E, B>) => (self: ReadonlyArray<A>) => Kind<F, R, O, E, B>;
/**

@@ -1313,3 +1052,3 @@ * @category folding

*/
export declare const foldMapWithIndex: <M>(Monoid: Monoid<M>) => <A>(f: (i: number, a: A) => M) => (self: readonly A[]) => M;
export declare const reduceRightKind: <F extends TypeLambda>(F: monad.Monad<F>) => <B, A, R, O, E>(b: B, f: (b: B, a: A) => Kind<F, R, O, E, B>) => (self: ReadonlyArray<A>) => Kind<F, R, O, E, B>;
/**

@@ -1319,19 +1058,4 @@ * @category folding

*/
export declare const reduceRightWithIndex: <B, A>(b: B, f: (i: number, a: A, b: B) => B) => (self: readonly A[]) => B;
export declare const foldMapKind: <F extends TypeLambda>(F: Coproduct<F>) => <A, R, O, E, B>(f: (a: A) => Kind<F, R, O, E, B>) => (self: ReadonlyArray<A>) => Kind<F, R, O, E, B>;
/**
* @category instances
* @since 1.0.0
*/
export declare const Traversable: traversable.Traversable<ReadonlyArrayTypeLambda>;
/**
* @category traversing
* @since 1.0.0
*/
export declare const sequence: <F extends TypeLambda>(F: applicative.Applicative<F>) => <R, O, E, A>(fas: ReadonlyArray<Kind<F, R, O, E, A>>) => Kind<F, R, O, E, ReadonlyArray<A>>;
/**
* @category traversing
* @since 1.0.0
*/
export declare const traverseTap: <F extends TypeLambda>(F: applicative.Applicative<F>) => <A, R, O, E, B>(f: (a: A) => Kind<F, R, O, E, B>) => (self: ReadonlyArray<A>) => Kind<F, R, O, E, ReadonlyArray<A>>;
/**
* @category filtering

@@ -1345,3 +1069,3 @@ * @since 1.0.0

*/
export declare const traversePartitionMap: <F extends TypeLambda>(F: applicative.Applicative<F>) => <A, R, O, E, B, C>(f: (a: A) => Kind<F, R, O, E, Either<B, C>>) => (wa: ReadonlyArray<A>) => Kind<F, R, O, E, readonly [ReadonlyArray<B>, ReadonlyArray<C>]>;
export declare const traversePartitionMap: <F extends TypeLambda>(F: applicative.Applicative<F>) => <A, R, O, E, B, C>(f: (a: A) => Kind<F, R, O, E, Either<B, C>>) => (self: ReadonlyArray<A>) => Kind<F, R, O, E, readonly [ReadonlyArray<B>, ReadonlyArray<C>]>;
/**

@@ -1355,19 +1079,2 @@ * @category instances

*
* @exampleTodo
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as T from '@fp-ts/core/typeclass/data/Async'
*
* const traverseFilter = RA.traverseFilter(T.MonoidalPar)
* async function test() {
* assert.deepStrictEqual(
* await pipe(
* [-1, 2, 3],
* traverseFilter((n) => T.of(n > 0))
* )(),
* [2, 3]
* )
* }
* test()
*
* @since 1.0.0

@@ -1412,3 +1119,3 @@ */

*/
export declare const flatMapNullable: <A, B>(f: (a: A) => B | null | undefined) => (ma: ReadonlyArray<A>) => ReadonlyArray<NonNullable<B>>;
export declare const flatMapNullable: <A, B>(f: (a: A) => B | null | undefined) => (self: ReadonlyArray<A>) => ReadonlyArray<NonNullable<B>>;
/**

@@ -1422,11 +1129,3 @@ * @category lifting

*
* @exampleTodo
* import { every } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const isPositive = (n: number): boolean => n > 0
*
* assert.deepStrictEqual(pipe([1, 2, 3], every(isPositive)), true)
* assert.deepStrictEqual(pipe([1, 2, -3], every(isPositive)), false)
*
* @category lifting
* @since 1.0.0

@@ -1439,14 +1138,6 @@ */

*
* @exampleTodo
* import { some } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const isPositive = (n: number): boolean => n > 0
*
* assert.deepStrictEqual(pipe([-1, -2, 3], some(isPositive)), true)
* assert.deepStrictEqual(pipe([-1, -2, -3], some(isPositive)), false)
*
* @category predicates
* @since 1.0.0
*/
export declare const some: <A>(predicate: Predicate<A>) => (as: readonly A[]) => as is readonly [A, ...A[]];
export declare const some: <A>(predicate: Predicate<A>) => (self: readonly A[]) => self is readonly [A, ...A[]];
/**

@@ -1457,3 +1148,3 @@ * Alias of [`some`](#some)

*/
export declare const exists: <A>(predicate: Predicate<A>) => (as: readonly A[]) => as is readonly [A, ...A[]];
export declare const has: <A>(predicate: Predicate<A>) => (self: readonly A[]) => self is readonly [A, ...A[]];
/**

@@ -1463,38 +1154,71 @@ * Fold a data structure, accumulating values in some `Monoid`, combining adjacent elements

*
* @exampleTodo
* import * as S from '@fp-ts/core/typeclass/data/string'
* import { intercalate } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* @since 1.0.0
*/
export declare const intercalate: <A>(M: Monoid<A>) => (middle: A) => (self: readonly A[]) => A;
/**
* Places an element in between members of a `NonEmptyReadonlyArray`, then folds the results using the provided `Semigroup`.
*
* assert.deepStrictEqual(intercalate(S.Monoid)('-')(['a', 'b', 'c']), 'a-b-c')
*
* @since 1.0.0
*/
export declare const intercalate: <A>(M: Monoid<A>) => (middle: A) => (as: readonly A[]) => A;
export declare const intercalateNonEmpty: <A>(S: Semigroup<A>) => (middle: A) => (self: readonly [A, ...A[]]) => A;
/**
* @category do notation
* @since 1.0.0
*/
export declare const Do: ReadonlyArray<{}>;
declare const let_: <N extends string, A extends object, B>(name: Exclude<N, keyof A>, f: (a: A) => B) => (self: ReadonlyArray<A>) => ReadonlyArray<{
readonly [K in N | keyof A]: K extends keyof A ? A[K] : B;
}>;
export {
export declare const productFlatten: <B>(that: ReadonlyArray<B>) => <A extends ReadonlyArray<unknown>>(self: ReadonlyArray<A>) => ReadonlyArray<readonly [...A, B]>;
/**
* @category do notation
* @since 1.0.0
*/
let_ as let };
export declare const extend: <A, B>(f: (as: readonly A[]) => B) => (self: readonly A[]) => readonly B[];
/**
* A variant of `bind` that sequentially ignores the scope.
* @since 1.0.0
*/
export declare const min: <A>(O: order.Order<A>) => (self: readonly [A, ...A[]]) => A;
/**
* @since 1.0.0
*/
export declare const max: <A>(O: order.Order<A>) => (self: readonly [A, ...A[]]) => A;
/**
* @category constructors
* @since 1.0.0
*/
export declare const unfold: <B, A>(b: B, f: (b: B) => Option<readonly [A, B]>) => readonly A[];
/**
* @category instances
* @since 1.0.0
*/
export declare const getUnionSemigroup: <A>() => Semigroup<readonly A[]>;
/**
* @category instances
* @since 1.0.0
*/
export declare const getUnionMonoid: <A>() => Monoid<readonly A[]>;
/**
* @category instances
* @since 1.0.0
*/
export declare const getIntersectionSemigroup: <A>() => Semigroup<readonly A[]>;
/**
* Returns a `Semigroup` for `ReadonlyArray<A>`.
*
* @category do notation
* @category instances
* @since 1.0.0
*/
export declare const bindReadonlyArray: <N extends string, A extends object, B>(name: Exclude<N, keyof A>, fb: ReadonlyArray<B>) => (self: ReadonlyArray<A>) => ReadonlyArray<{
readonly [K in N | keyof A]: K extends keyof A ? A[K] : B;
}>;
export declare const getSemigroup: <A>() => Semigroup<readonly A[]>;
/**
* Returns a `Monoid` for `ReadonlyArray<A>`.
*
* @category instances
* @since 1.0.0
*/
export declare const productFlatten: <B>(fb: ReadonlyArray<B>) => <A extends ReadonlyArray<unknown>>(self: ReadonlyArray<A>) => ReadonlyArray<readonly [...A, B]>;
export declare const getMonoid: <A>() => Monoid<readonly A[]>;
/**
* Derives an `Order` over the `ReadonlyArray` of a given element type from the `Order` of that type. The ordering between two such
* `ReadonlyArray`s is equal to: the first non equal comparison of each `ReadonlyArray`s elements taken pairwise in increasing order, in
* case of equality over all the pairwise elements; the longest `ReadonlyArray` is considered the greatest, if both `ReadonlyArray`s have
* the same length, the result is equality.
*
* @category lifting
* @since 1.0.0
*/
export declare const liftOrder: <A>(O: order.Order<A>) => order.Order<readonly A[]>;
//# sourceMappingURL=ReadonlyArray.d.ts.map

@@ -6,16 +6,22 @@ "use strict";

});
exports.dropLeft = exports.difference = exports.deleteAt = exports.cross = exports.concat = exports.composeKleisliArrow = exports.compact = exports.chunksOf = exports.chop = exports.bindTo = exports.bindReadonlyArray = exports.bind = exports.asUnit = exports.as = exports.append = exports.ap = exports.andThenDiscard = exports.andThen = exports.TraversableFilterable = exports.Traversable = exports.Product = exports.Pointed = exports.Of = exports.NonEmptyProduct = exports.NonEmptyApplicative = exports.Monad = exports.Invariant = exports.FromOption = exports.Foldable = exports.FlatMap = exports.Filterable = exports.Do = exports.Covariant = exports.Compactable = exports.Chainable = exports.Applicative = void 0;
exports.dropLeftWhile = dropLeftWhile;
exports.empty = exports.elem = exports.dropRight = void 0;
exports.appendAll = exports.append = exports.ap = exports.TraversableFilterable = exports.Traversable = exports.Product = exports.Pointed = exports.Of = exports.NonEmptyProduct = exports.NonEmptyApplicative = exports.Monad = exports.Invariant = exports.FromOption = exports.Foldable = exports.FlatMap = exports.Filterable = exports.Do = exports.Covariant = exports.Compactable = exports.Chainable = exports.Applicative = void 0;
exports.appendAllNonEmpty = appendAllNonEmpty;
exports.dropRight = exports.drop = exports.difference = exports.deleteAt = exports.composeKleisliArrow = exports.compact = exports.chunksOfNonEmpty = exports.chunksOf = exports.chopNonEmpty = exports.chop = exports.bindReadonlyArray = exports.bind = exports.as = void 0;
exports.dropWhile = dropWhile;
exports.empty = exports.elem = void 0;
exports.every = every;
exports.filterWithIndex = exports.filterMapWithIndex = exports.filterMap = exports.filter = exports.extend = exports.exists = void 0;
exports.filterWithIndex = exports.filterMapWithIndex = exports.filterMap = exports.filter = exports.extend = void 0;
exports.findFirst = findFirst;
exports.findIndex = exports.findFirstMap = void 0;
exports.findIndex = void 0;
exports.findLast = findLast;
exports.modifyAt = exports.matchRight = exports.matchLeft = exports.match = exports.mapWithIndex = exports.map = exports.makeBy = exports.lookup = exports.liftSemigroup = exports.liftPredicate = exports.liftOrder = exports.liftOption = exports.liftNullable = exports.liftMonoid = exports.liftEither = exports.lift3 = exports.lift2 = exports.let = exports.lefts = exports.last = exports.isOutOfBound = exports.isNonEmpty = exports.isEmpty = exports.intersperse = exports.intersection = exports.intercalate = exports.insertAt = exports.init = exports.imap = exports.head = exports.getUnionSemigroup = exports.getUnionMonoid = exports.getSemigroup = exports.getMonoid = exports.getIntersectionSemigroup = exports.fromOption = exports.fromNullable = exports.fromIterable = exports.fromEither = exports.foldMapWithIndex = exports.foldMapKind = exports.foldMap = exports.flatten = exports.flatMapWithIndex = exports.flatMapNullable = exports.flatMap = exports.flap = exports.findLastMap = exports.findLastIndex = void 0;
exports.sortBy = exports.sort = exports.some = exports.size = exports.sequence = exports.separate = exports.scanRight = exports.scanLeft = exports.rotate = exports.rights = exports.reverse = exports.replicate = exports.reduceWithIndex = exports.reduceRightWithIndex = exports.reduceRightKind = exports.reduceRight = exports.reduceKind = exports.reduce = exports.range = exports.productMany = exports.productFlatten = exports.productAll = exports.product = exports.prependAll = exports.prepend = exports.partitionWithIndex = exports.partitionMapWithIndex = exports.partitionMap = exports.partition = exports.orElse = exports.of = void 0;
exports.spanLeft = spanLeft;
exports.takeLeft = exports.tail = exports.splitAt = void 0;
exports.takeLeftWhile = takeLeftWhile;
exports.zipWith = exports.zipMany = exports.zipAll = exports.zip = exports.updateAt = exports.unzip = exports.uniq = exports.union = exports.unfold = exports.tupled = exports.traverseWithIndex = exports.traverseTap = exports.traversePartitionMap = exports.traversePartition = exports.traverseFilterMap = exports.traverseFilter = exports.traverse = exports.tap = exports.takeRight = void 0;
exports.liftSemigroup = exports.liftPredicate = exports.liftOrder = exports.liftOption = exports.liftNullable = exports.liftMonoid = exports.liftEither = exports.lift3 = exports.lift2 = exports.let = exports.lefts = exports.lastNonEmpty = exports.last = exports.isNonEmpty = exports.isEmpty = exports.intersperseNonEmpty = exports.intersperse = exports.intersection = exports.intercalateNonEmpty = exports.intercalate = exports.insertAt = exports.initNonEmpty = exports.init = exports.imap = exports.headNonEmpty = exports.head = exports.has = exports.groupBy = exports.group = exports.getUnionSemigroup = exports.getUnionMonoid = exports.getSemigroup = exports.getMonoid = exports.getIntersectionSemigroup = exports.get = exports.fromOption = exports.fromNullable = exports.fromIterable = exports.fromEither = exports.foldMapWithIndex = exports.foldMapNonEmptyWithIndex = exports.foldMapNonEmpty = exports.foldMapKind = exports.foldMap = exports.flattenNonEmpty = exports.flatten = exports.flatMapWithIndex = exports.flatMapNullable = exports.flatMapNonEmptyWithIndex = exports.flatMapNonEmpty = exports.flatMap = exports.flap = exports.findLastIndex = void 0;
exports.prependAll = exports.prepend = exports.partitionWithIndex = exports.partitionMapWithIndex = exports.partitionMap = exports.partition = exports.of = exports.modifyNonEmptyLast = exports.modifyNonEmptyHead = exports.modifyAt = exports.min = exports.max = exports.matchRight = exports.match = exports.mapWithIndex = exports.mapNonEmptyWithIndex = exports.mapNonEmpty = exports.map = exports.makeBy = exports.make = void 0;
exports.prependAllNonEmpty = prependAllNonEmpty;
exports.sortNonEmpty = exports.sortByNonEmpty = exports.sortBy = exports.sort = exports.some = exports.size = exports.sequenceNonEmpty = exports.sequence = exports.separate = exports.scanRight = exports.scan = exports.rotateNonEmpty = exports.rotate = exports.rights = exports.reverseNonEmpty = exports.reverse = exports.replicate = exports.reduceWithIndex = exports.reduceRightWithIndex = exports.reduceRightKind = exports.reduceRight = exports.reduceKind = exports.reduce = exports.range = exports.productMany = exports.productFlatten = exports.productAll = exports.product = void 0;
exports.span = span;
exports.takeRight = exports.take = exports.tailNonEmpty = exports.tail = exports.splitNonEmptyAt = exports.splitAt = void 0;
exports.takeWhile = takeWhile;
exports.union = exports.unfold = exports.unappend = exports.traverseWithIndex = exports.traverseTap = exports.traversePartitionMap = exports.traversePartition = exports.traverseNonEmptyWithIndex = exports.traverseNonEmpty = exports.traverseFilterMap = exports.traverseFilter = exports.traverse = void 0;
exports.unionNonEmpty = unionNonEmpty;
exports.zipWith = exports.zipNonEmptyWith = exports.zipNonEmpty = exports.zip = exports.updateNonEmptyLast = exports.updateNonEmptyHead = exports.updateAt = exports.unzipNonEmpty = exports.unzip = exports.unprepend = exports.uniqNonEmpty = exports.uniq = void 0;

@@ -34,4 +40,2 @@ var applicative = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Applicative"));

var invariant = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Invariant"));
var nonEmptyApplicative = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/NonEmptyApplicative"));

@@ -41,5 +45,7 @@

var of_ = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Of"));
var order = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Order"));
var _Semigroup = /*#__PURE__*/require("@fp-ts/core/typeclass/Semigroup");
var semigroup = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Semigroup"));

@@ -58,4 +64,2 @@ var traversable = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/typeclass/Traversable"));

var nonEmptyReadonlyArray = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/NonEmptyReadonlyArray"));
var number = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/data/Number"));

@@ -70,18 +74,13 @@

/**
* @category conversions
* Builds a `NonEmptyReadonlyArray` from an non-empty collection of elements.
*
* @category constructors
* @since 1.0.0
*/
const fromIterable = internal.fromIterable;
const make = (...as) => as;
/**
* Return a `ReadonlyArray` of length `n` with element `i` initialized with `f(i)`.
*
* **Note**. `n` is normalized to a non negative integer.
* **Note**. `n` is normalized to an integer >= 1.
*
* @exampleTodo
* import { makeBy } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const double = (n: number): number => n * 2
* assert.deepStrictEqual(pipe(5, makeBy(double)), [0, 2, 4, 6, 8])
*
* @category constructors

@@ -91,13 +90,18 @@ * @since 1.0.0

exports.fromIterable = fromIterable;
const makeBy = f => n => n <= 0 ? empty : nonEmptyReadonlyArray.makeBy(f)(n);
exports.make = make;
const makeBy = f => n => {
const max = Math.max(1, Math.floor(n));
const out = [f(0)];
for (let i = 1; i < max; i++) {
out.push(f(i));
}
return out;
};
/**
* Create a `ReadonlyArray` containing a range of integers, including both endpoints.
* Create a non empty `ReadonlyArray` containing a range of integers, including both endpoints.
*
* @exampleTodo
* import { range } from '@fp-ts/data/ReadonlyArray'
*
* assert.deepStrictEqual(range(1, 5), [1, 2, 3, 4, 5])
*
* @category constructors

@@ -109,14 +113,9 @@ * @since 1.0.0

exports.makeBy = makeBy;
const range = nonEmptyReadonlyArray.range;
const range = (start, end) => start <= end ? makeBy(i => start + i)(end - start + 1) : [start];
/**
* Create a `ReadonlyArray` containing a value repeated the specified number of times.
*
* **Note**. `n` is normalized to a non negative integer.
* **Note**. `n` is normalized to an integer >= 1.
*
* @exampleTodo
* import { replicate } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe(3, replicate('a')), ['a', 'a', 'a'])
*
* @category constructors

@@ -126,2 +125,3 @@ * @since 1.0.0

exports.range = range;

@@ -137,7 +137,12 @@

exports.replicate = replicate;
const fromIterable = internal.fromIterable;
/**
* @category conversions
* @since 1.0.0
*/
const fromOption = ma => internal.isNone(ma) ? empty : [ma.value];
exports.fromIterable = fromIterable;
const fromOption = o => internal.isNone(o) ? empty : [o.value];
/**
* Converts an `Either` to a `ReadonlyArray`.
*
* @category conversions

@@ -150,6 +155,3 @@ * @since 1.0.0

const fromEither = e => either.isLeft(e) ? empty : [e.right]; // -------------------------------------------------------------------------------------
// pattern matching
// -------------------------------------------------------------------------------------
const fromEither = e => either.isLeft(e) ? empty : [e.right];
/**

@@ -163,12 +165,4 @@ * @category pattern matching

const match = (onEmpty, onNonEmpty) => as => isNonEmpty(as) ? onNonEmpty(as) : onEmpty();
const match = (onEmpty, onNonEmpty) => self => isNonEmpty(self) ? onNonEmpty(headNonEmpty(self), tailNonEmpty(self)) : onEmpty();
/**
* Break a `ReadonlyArray` into its first element and remaining elements.
*
* @exampleTodo
* import { matchLeft } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* const len: <A>(as: ReadonlyArray<A>) => number = matchLeft(() => 0, (_, tail) => 1 + len(tail))
* assert.strictEqual(len([1, 2, 3]), 3)
*
* @category pattern matching

@@ -181,7 +175,7 @@ * @since 1.0.0

const matchLeft = (onEmpty, onNonEmpty) => as => isNonEmpty(as) ? onNonEmpty(nonEmptyReadonlyArray.head(as), nonEmptyReadonlyArray.tail(as)) : onEmpty();
const matchRight = (onEmpty, onNonEmpty) => self => isNonEmpty(self) ? onNonEmpty(initNonEmpty(self), lastNonEmpty(self)) : onEmpty();
/**
* Break a `ReadonlyArray` into its initial elements and the last element.
* Prepend an element to the front of a `ReadonlyArray`, creating a new non empty `ReadonlyArray`.
*
* @category pattern matching
* @category mutations
* @since 1.0.0

@@ -191,6 +185,7 @@ */

exports.matchLeft = matchLeft;
exports.matchRight = matchRight;
const matchRight = (onEmpty, onNonEmpty) => as => isNonEmpty(as) ? onNonEmpty(nonEmptyReadonlyArray.init(as), nonEmptyReadonlyArray.last(as)) : onEmpty();
const prepend = head => self => [head, ...self];
/**
* @category mutations
* @since 1.0.0

@@ -200,13 +195,39 @@ */

exports.matchRight = matchRight;
exports.prepend = prepend;
const concat = that => self => isEmpty(self) ? that : isEmpty(that) ? self : self.concat(that);
const prependAll = prefix => self => prefix.concat(self);
exports.prependAll = prependAll;
function prependAllNonEmpty(that) {
return self => that.concat(self);
}
/**
* Append an element to the end of a `ReadonlyArray`, creating a new non empty `ReadonlyArray`.
*
* @category mutations
* @since 1.0.0
*/
const append = last => self => [...self, last];
/**
* @category mutations
* @since 1.0.0
*/
exports.append = append;
const appendAll = that => self => self.concat(that);
exports.appendAll = appendAll;
function appendAllNonEmpty(that) {
return self => self.concat(that);
}
/**
* Fold a `ReadonlyArray` from the left, keeping all intermediate results instead of only the final result.
*
* @exampleTodo
* import { scanLeft } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.deepStrictEqual(scanLeft(10, (b, a: number) => b - a)([1, 2, 3]), [10, 9, 7, 4])
*
* @category folding
* @since 1.0.0

@@ -216,6 +237,4 @@ */

exports.concat = concat;
const scanLeft = (b, f) => as => {
const len = as.length;
const scan = (b, f) => self => {
const len = self.length;
const out = new Array(len + 1);

@@ -225,3 +244,3 @@ out[0] = b;

for (let i = 0; i < len; i++) {
out[i + 1] = f(out[i], as[i]);
out[i + 1] = f(out[i], self[i]);
}

@@ -234,7 +253,3 @@

*
* @exampleTodo
* import { scanRight } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.deepStrictEqual(scanRight(10, (a: number, b) => b - a)([1, 2, 3]), [4, 5, 7, 10])
*
* @category folding
* @since 1.0.0

@@ -244,6 +259,6 @@ */

exports.scanLeft = scanLeft;
exports.scan = scan;
const scanRight = (b, f) => as => {
const len = as.length;
const scanRight = (b, f) => self => {
const len = self.length;
const out = new Array(len + 1);

@@ -253,3 +268,3 @@ out[len] = b;

for (let i = len - 1; i >= 0; i--) {
out[i] = f(as[i], out[i + 1]);
out[i] = f(out[i + 1], self[i]);
}

@@ -262,7 +277,3 @@

*
* @exampleTodo
* import { isEmpty } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.strictEqual(isEmpty([]), true)
*
* @category predicates
* @since 1.0.0

@@ -274,7 +285,7 @@ */

const isEmpty = as => as.length === 0;
const isEmpty = self => self.length === 0;
/**
* Test whether a `ReadonlyArray` is non empty narrowing down the type to `NonEmptyReadonlyArray<A>`
*
* @category refinements
* @category predicates
* @since 1.0.0

@@ -289,2 +300,3 @@ */

*
* @category getters
* @since 1.0.0

@@ -295,39 +307,20 @@ */

const size = as => as.length;
/**
* Test whether a `ReadonlyArray` contains a particular index
*
* @since 1.0.0
*/
const size = self => self.length;
exports.size = size;
exports.size = size;
const isOutOfBound = nonEmptyReadonlyArray.isOutOfBound;
const isOutOfBound = (i, as) => i < 0 || i >= as.length;
/**
* This function provides a safe way to read a value at a particular index from a `ReadonlyArray`
*
* @exampleTodo
* import { lookup } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2, 3], lookup(1)), some(2))
* assert.deepStrictEqual(pipe([1, 2, 3], lookup(3)), none)
*
* @category getters
* @since 1.0.0
*/
exports.isOutOfBound = isOutOfBound;
const lookup = i => as => isOutOfBound(i, as) ? internal.none : internal.some(as[i]);
const get = i => self => isOutOfBound(i, self) ? internal.none : internal.some(self[i]);
/**
* Prepend an element to the front of a `ReadonlyArray`, creating a new `NonEmptyReadonlyArray`.
* Produces a couple of the first element of the array, and a new array of the remaining elements, if any.
*
* @exampleTodo
* import { prepend } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2, 3], prepend(0)), [0, 1, 2, 3])
*
* @category constructors
* @category getters
* @since 1.0.0

@@ -337,45 +330,40 @@ */

exports.lookup = lookup;
const prepend = nonEmptyReadonlyArray.prepend;
exports.get = get;
const unprepend = self => [headNonEmpty(self), tailNonEmpty(self)];
/**
* Append an element to the end of a `ReadonlyArray`, creating a new `NonEmptyReadonlyArray`.
* Produces a couple of a copy of the array without its last element, and that last element.
*
* @exampleTodo
* import { append } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2, 3], append(4)), [1, 2, 3, 4])
*
* @category constructors
* @category getters
* @since 1.0.0
*/
exports.prepend = prepend;
const append = nonEmptyReadonlyArray.append;
exports.unprepend = unprepend;
const unappend = self => [initNonEmpty(self), lastNonEmpty(self)];
/**
* Get the first element of a `ReadonlyArray`, or `None` if the `ReadonlyArray` is empty.
*
* @exampleTodo
* import { head } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(head([1, 2, 3]), some(1))
* assert.deepStrictEqual(head([]), none)
*
* @category getters
* @since 1.0.0
*/
exports.append = append;
exports.unappend = unappend;
const head = self => isNonEmpty(self) ? internal.some(self[0]) : internal.none;
/**
* @category getters
* @since 1.0.0
*/
exports.head = head;
const headNonEmpty = self => self[0];
/**
* Get the last element in a `ReadonlyArray`, or `None` if the `ReadonlyArray` is empty.
*
* @exampleTodo
* import { last } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(last([1, 2, 3]), some(3))
* assert.deepStrictEqual(last([]), none)
*
* @category getters
* @since 1.0.0

@@ -385,15 +373,18 @@ */

exports.head = head;
exports.headNonEmpty = headNonEmpty;
const last = as => isNonEmpty(as) ? internal.some(nonEmptyReadonlyArray.last(as)) : internal.none;
const last = self => isNonEmpty(self) ? internal.some(lastNonEmpty(self)) : internal.none;
/**
* @category getters
* @since 1.0.0
*/
exports.last = last;
const lastNonEmpty = as => as[as.length - 1];
/**
* Get all but the first element of a `ReadonlyArray`, creating a new `ReadonlyArray`, or `None` if the `ReadonlyArray` is empty.
*
* @exampleTodo
* import { tail } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(tail([1, 2, 3]), some([2, 3]))
* assert.deepStrictEqual(tail([]), none)
*
* @category getters
* @since 1.0.0

@@ -403,15 +394,29 @@ */

exports.last = last;
exports.lastNonEmpty = lastNonEmpty;
const tail = as => isNonEmpty(as) ? internal.some(nonEmptyReadonlyArray.tail(as)) : internal.none;
const tail = self => isNonEmpty(self) ? internal.some(tailNonEmpty(self)) : internal.none;
/**
* @category getters
* @since 1.0.0
*/
exports.tail = tail;
const tailNonEmpty = self => self.slice(1);
/**
* Get all but the last element of a `ReadonlyArray`, creating a new `ReadonlyArray`, or `None` if the `ReadonlyArray` is empty.
*
* @exampleTodo
* import { init } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
* @category getters
* @since 1.0.0
*/
exports.tailNonEmpty = tailNonEmpty;
const init = self => isNonEmpty(self) ? internal.some(initNonEmpty(self)) : internal.none;
/**
* Get all but the last element of a non empty array, creating a new array.
*
* assert.deepStrictEqual(init([1, 2, 3]), some([1, 2]))
* assert.deepStrictEqual(init([]), none)
*
* @category getters
* @since 1.0.0

@@ -421,5 +426,5 @@ */

exports.tail = tail;
exports.init = init;
const init = as => isNonEmpty(as) ? internal.some(nonEmptyReadonlyArray.init(as)) : internal.none;
const initNonEmpty = self => self.slice(0, -1);
/**

@@ -430,13 +435,3 @@ * Keep only a max number of elements from the start of an `ReadonlyArray`, creating a new `ReadonlyArray`.

*
* @exampleTodo
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const input: ReadonlyArray<number> = [1, 2, 3]
* assert.deepStrictEqual(pipe(input, RA.takeLeft(2)), [1, 2])
*
* // out of bounds
* assert.strictEqual(pipe(input, RA.takeLeft(4)), input)
* assert.strictEqual(pipe(input, RA.takeLeft(-1)), input)
*
* @category getters
* @since 1.0.0

@@ -446,5 +441,5 @@ */

exports.init = init;
exports.initNonEmpty = initNonEmpty;
const takeLeft = n => as => isOutOfBound(n, as) ? as : n === 0 ? empty : as.slice(0, n);
const take = n => self => n <= 0 ? empty : n >= self.length ? self : self.slice(0, n);
/**

@@ -455,13 +450,3 @@ * Keep only a max number of elements from the end of an `ReadonlyArray`, creating a new `ReadonlyArray`.

*
* @exampleTodo
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const input: ReadonlyArray<number> = [1, 2, 3]
* assert.deepStrictEqual(pipe(input, RA.takeRight(2)), [2, 3])
*
* // out of bounds
* assert.strictEqual(pipe(input, RA.takeRight(4)), input)
* assert.strictEqual(pipe(input, RA.takeRight(-1)), input)
*
* @category getters
* @since 1.0.0

@@ -471,3 +456,3 @@ */

exports.takeLeft = takeLeft;
exports.take = take;

@@ -478,7 +463,7 @@ const takeRight = n => as => isOutOfBound(n, as) ? as : n === 0 ? empty : as.slice(-n);

function takeLeftWhile(predicate) {
return as => {
function takeWhile(predicate) {
return self => {
const out = [];
for (const a of as) {
for (const a of self) {
if (!predicate(a)) {

@@ -491,8 +476,7 @@ break;

const len = out.length;
return len === as.length ? as : len === 0 ? empty : out;
return out;
};
}
const spanLeftIndex = (as, predicate) => {
const spanIndex = (as, predicate) => {
const l = as.length;

@@ -510,4 +494,4 @@ let i = 0;

function spanLeft(predicate) {
return as => splitAt(spanLeftIndex(as, predicate))(as);
function span(predicate) {
return as => splitAt(spanIndex(as, predicate))(as);
}

@@ -519,11 +503,3 @@ /**

*
* @exampleTodo
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const input: ReadonlyArray<number> = [1, 2, 3]
* assert.deepStrictEqual(pipe(input, RA.dropLeft(2)), [3])
* assert.strictEqual(pipe(input, RA.dropLeft(0)), input)
* assert.strictEqual(pipe(input, RA.dropLeft(-1)), input)
*
* @category getters
* @since 1.0.0

@@ -533,3 +509,3 @@ */

const dropLeft = n => as => n <= 0 || isEmpty(as) ? as : n >= as.length ? empty : as.slice(n, as.length);
const drop = n => as => n <= 0 || isEmpty(as) ? as : n >= as.length ? empty : as.slice(n, as.length);
/**

@@ -540,11 +516,3 @@ * Drop a max number of elements from the end of an `ReadonlyArray`, creating a new `ReadonlyArray`.

*
* @exampleTodo
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const input: ReadonlyArray<number> = [1, 2, 3]
* assert.deepStrictEqual(pipe(input, RA.dropRight(2)), [1])
* assert.strictEqual(pipe(input, RA.dropRight(0)), input)
* assert.strictEqual(pipe(input, RA.dropRight(-1)), input)
*
* @category getters
* @since 1.0.0

@@ -554,3 +522,3 @@ */

exports.dropLeft = dropLeft;
exports.drop = drop;

@@ -561,5 +529,5 @@ const dropRight = n => as => n <= 0 || isEmpty(as) ? as : n >= as.length ? empty : as.slice(0, as.length - n);

function dropLeftWhile(predicate) {
function dropWhile(predicate) {
return as => {
const i = spanLeftIndex(as, predicate);
const i = spanIndex(as, predicate);
return i === 0 ? as : i === as.length ? empty : as.slice(i);

@@ -571,9 +539,3 @@ };

*
* @exampleTodo
* import { findIndex } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(findIndex((n: number) => n === 2)([1, 2, 3]), some(1))
* assert.deepStrictEqual(findIndex((n: number) => n === 2)([]), none)
*
* @category getters
* @since 1.0.0

@@ -594,5 +556,26 @@ */

};
/**
* Returns the index of the last element of the list which matches the predicate
*
* @category getters
* @since 1.0.0
*/
exports.findIndex = findIndex;
const findLastIndex = predicate => as => {
const len = as.length;
for (let i = len - 1; i >= 0; i--) {
if (predicate(as[i])) {
return internal.some(i);
}
}
return internal.none;
};
exports.findLastIndex = findLastIndex;
function findFirst(predicate) {

@@ -611,39 +594,3 @@ return as => {

}
/**
* Find the first element returned by an option based selector function
*
* @exampleTodo
* import { findFirstMap } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* interface Person {
* name: string
* age?: number
* }
*
* const persons: ReadonlyArray<Person> = [{ name: 'John' }, { name: 'Mary', age: 45 }, { name: 'Joey', age: 28 }]
*
* // returns the name of the first person that has an age
* assert.deepStrictEqual(findFirstMap((p: Person) => (p.age === undefined ? none : some(p.name)))(persons), some('Mary'))
*
* @since 1.0.0
*/
const findFirstMap = f => as => {
const len = as.length;
for (let i = 0; i < len; i++) {
const v = f(as[i]);
if (internal.isSome(v)) {
return v;
}
}
return internal.none;
};
exports.findFirstMap = findFirstMap;
function findLast(predicate) {

@@ -663,76 +610,5 @@ return as => {

/**
* Find the last element returned by an option based selector function
*
* @exampleTodo
* import { findLastMap } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* interface Person {
* name: string
* age?: number
* }
*
* const persons: ReadonlyArray<Person> = [{ name: 'John' }, { name: 'Mary', age: 45 }, { name: 'Joey', age: 28 }]
*
* // returns the name of the last person that has an age
* assert.deepStrictEqual(findLastMap((p: Person) => (p.age === undefined ? none : some(p.name)))(persons), some('Joey'))
*
* @since 1.0.0
*/
const findLastMap = f => as => {
const len = as.length;
for (let i = len - 1; i >= 0; i--) {
const v = f(as[i]);
if (internal.isSome(v)) {
return v;
}
}
return internal.none;
};
/**
* Returns the index of the last element of the list which matches the predicate
*
* @exampleTodo
* import { findLastIndex } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* interface X {
* a: number
* b: number
* }
* const xs: ReadonlyArray<X> = [{ a: 1, b: 0 }, { a: 1, b: 1 }]
* assert.deepStrictEqual(findLastIndex((x: { a: number }) => x.a === 1)(xs), some(1))
* assert.deepStrictEqual(findLastIndex((x: { a: number }) => x.a === 4)(xs), none)
*
* @since 1.0.0
*/
exports.findLastMap = findLastMap;
const findLastIndex = predicate => as => {
const len = as.length;
for (let i = len - 1; i >= 0; i--) {
if (predicate(as[i])) {
return internal.some(i);
}
}
return internal.none;
};
/**
* Insert an element at the specified index, creating a new `ReadonlyArray`, or returning `None` if the index is out of bounds.
*
* @exampleTodo
* import { insertAt } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(insertAt(2, 5)([1, 2, 3, 4]), some([1, 2, 5, 3, 4]))
*
* @category mutations
* @since 1.0.0

@@ -742,11 +618,9 @@ */

exports.findLastIndex = findLastIndex;
const insertAt = (i, a) => as => {
if (i < 0 || i > as.length) {
const insertAt = (i, a) => self => {
if (i < 0 || i > self.length) {
return internal.none;
}
if (isNonEmpty(as)) {
const out = internal.fromNonEmptyReadonlyArray(as);
if (isNonEmpty(self)) {
const out = internal.fromNonEmptyReadonlyArray(self);
out.splice(i, 0, a);

@@ -761,9 +635,3 @@ return internal.some(out);

*
* @exampleTodo
* import { updateAt } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(updateAt(1, 1)([1, 2, 3]), some([1, 1, 3]))
* assert.deepStrictEqual(updateAt(1, 1)([]), none)
*
* @category mutations
* @since 1.0.0

@@ -775,3 +643,3 @@ */

const updateAt = (i, a) => modifyAt(i, () => a);
const updateAt = (i, b) => modifyAt(i, () => b);
/**

@@ -781,10 +649,3 @@ * Apply a function to the element at the specified index, creating a new `ReadonlyArray`, or returning `None` if the index is out

*
* @exampleTodo
* import { modifyAt } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* const double = (x: number): number => x * 2
* assert.deepStrictEqual(modifyAt(1, double)([1, 2, 3]), some([1, 4, 3]))
* assert.deepStrictEqual(modifyAt(1, double)([]), none)
*
* @category mutations
* @since 1.0.0

@@ -796,15 +657,10 @@ */

const modifyAt = (i, f) => as => {
if (isOutOfBound(i, as)) {
const modifyAt = (i, f) => self => {
if (isOutOfBound(i, self)) {
return internal.none;
}
const prev = as[i];
const prev = self[i];
const next = f(prev);
if (next === prev) {
return internal.some(as);
}
const out = as.slice();
const out = self.slice();
out[i] = next;

@@ -824,9 +680,3 @@ return internal.some(out);

*
* @exampleTodo
* import { deleteAt } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { some, none } from '@fp-ts/core/typeclass/data/Option'
*
* assert.deepStrictEqual(deleteAt(0)([1, 2, 3]), some([2, 3]))
* assert.deepStrictEqual(deleteAt(1)([]), none)
*
* @category mutations
* @since 1.0.0

@@ -836,11 +686,7 @@ */

const deleteAt = i => as => isOutOfBound(i, as) ? internal.none : internal.some(unsafeDeleteAt(i, as));
const deleteAt = i => self => isOutOfBound(i, self) ? internal.none : internal.some(unsafeDeleteAt(i, self));
/**
* Reverse a `ReadonlyArray`, creating a new `ReadonlyArray`.
*
* @exampleTodo
* import { reverse } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.deepStrictEqual(reverse([1, 2, 3]), [3, 2, 1])
*
* @category mutations
* @since 1.0.0

@@ -852,12 +698,4 @@ */

const reverse = as => as.length <= 1 ? as : as.slice().reverse();
const reverse = self => self.length <= 1 ? self : self.slice().reverse();
/**
* Extracts from a `ReadonlyArray` of `Either`s all the `Success` elements.
*
* @exampleTodo
* import { rights } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { right, left } from '@fp-ts/core/typeclass/data/Either'
*
* assert.deepStrictEqual(rights([succeed(1), left('foo'), right(2)]), [1, 2])
*
* @since 1.0.0

@@ -869,8 +707,18 @@ */

const rights = as => {
const len = as.length;
const reverseNonEmpty = self => self.length === 1 ? self : [lastNonEmpty(self), ...self.slice(0, -1).reverse()];
/**
* Extracts from a `ReadonlyArray` of `Either`s all the `Right` elements.
*
* @category getters
* @since 1.0.0
*/
exports.reverseNonEmpty = reverseNonEmpty;
const rights = self => {
const out = [];
for (let i = 0; i < len; i++) {
const a = as[i];
for (let i = 0; i < self.length; i++) {
const a = self[i];

@@ -885,10 +733,5 @@ if (either.isRight(a)) {

/**
* Extracts from a `ReadonlyArray` of `Either` all the `Failure` elements. All the `Failure` elements are extracted in order
* Extracts from a `ReadonlyArray` of `Either` all the `Left` elements.
*
* @exampleTodo
* import { lefts } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { left, right } from '@fp-ts/core/typeclass/data/Either'
*
* assert.deepStrictEqual(failures([right(1), left('foo'), right(2)]), ['foo'])
*
* @category getters
* @since 1.0.0

@@ -900,8 +743,7 @@ */

const lefts = as => {
const lefts = self => {
const out = [];
const len = as.length;
for (let i = 0; i < len; i++) {
const a = as[i];
for (let i = 0; i < self.length; i++) {
const a = self[i];

@@ -918,8 +760,3 @@ if (either.isLeft(a)) {

*
* @exampleTodo
* import { sort } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as N from '@fp-ts/core/typeclass/data/number'
*
* assert.deepStrictEqual(sort(N.Order)([3, 2, 1]), [1, 2, 3])
*
* @category sorting
* @since 1.0.0

@@ -931,13 +768,7 @@ */

const sort = O => as => as.length <= 1 ? as : as.slice().sort((self, that) => O.compare(that)(self));
const sort = O => self => self.length <= 1 ? self : self.slice().sort((self, that) => O.compare(that)(self));
/**
* Apply a function to pairs of elements at the same index in two `ReadonlyArray`s, collecting the results in a new `ReadonlyArray`. If one
* input `ReadonlyArray` is short, excess elements of the longer `ReadonlyArray` are discarded.
* Sort the elements of a `NonEmptyReadonlyArray` in increasing order, creating a new `NonEmptyReadonlyArray`.
*
* @exampleTodo
* import { zipWith } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2, 3], zipWith(['a', 'b', 'c', 'd'], (n, s) => s + n)), ['a1', 'b2', 'c3'])
*
* @category sorting
* @since 1.0.0

@@ -949,22 +780,29 @@ */

const zipWith = (fb, f) => fa => {
const out = [];
const len = Math.min(fa.length, fb.length);
const sortNonEmpty = O => self => self.length === 1 ? self : self.slice().sort((self, that) => O.compare(that)(self));
/**
* Sort the elements of a `ReadonlyArray` in increasing order, where elements are compared using first `ords[0]`, then `ords[1]`,
* etc...
*
* @category sorting
* @since 1.0.0
*/
for (let i = 0; i < len; i++) {
out[i] = f(fa[i], fb[i]);
}
return out;
};
exports.sortNonEmpty = sortNonEmpty;
const sortBy = orders => self => isNonEmpty(self) ? sortByNonEmpty(orders)(self) : self;
/**
* @category sorting
* @since 1.0.0
*/
exports.sortBy = sortBy;
const sortByNonEmpty = orders => sortNonEmpty(order.getMonoid().combineAll(orders));
/**
* Takes two `ReadonlyArray`s and returns a `ReadonlyArray` of corresponding pairs. If one input `ReadonlyArray` is short, excess elements of the
* longer `ReadonlyArray` are discarded.
*
* @exampleTodo
* import { zip } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2, 3], zip(['a', 'b', 'c', 'd'])), [[1, 'a'], [2, 'b'], [3, 'c']])
*
* @category mutations
* @since 1.0.0

@@ -974,6 +812,10 @@ */

exports.zipWith = zipWith;
exports.sortByNonEmpty = sortByNonEmpty;
const zip = bs => zipWith(bs, (a, b) => [a, b]);
const zip = that => zipWith(that, (a, b) => [a, b]);
/**
* Apply a function to pairs of elements at the same index in two `ReadonlyArray`s, collecting the results in a new `ReadonlyArray`. If one
* input `ReadonlyArray` is short, excess elements of the longer `ReadonlyArray` are discarded.
*
* @category mutations
* @since 1.0.0

@@ -985,27 +827,14 @@ */

const zipMany = collection => self => {
if (self.length === 0) {
return [];
}
const zipWith = (that, f) => self => isNonEmpty(self) && isNonEmpty(that) ? zipNonEmptyWith(that, f)(self) : internal.empty;
/**
* @category mutations
* @since 1.0.0
*/
const arrays = Array.from(collection);
const out = [];
for (let i = 0; i < self.length; i++) {
const inner = [self[i]];
exports.zipWith = zipWith;
for (const array of arrays) {
if (i > array.length - 1) {
return out;
}
inner.push(array[i]);
}
out.push(inner);
}
return out;
};
const zipNonEmpty = that => self => (0, _Function.pipe)(self, zipNonEmptyWith(that, (a, b) => [a, b]));
/**
* @category mutations
* @since 1.0.0

@@ -1015,12 +844,13 @@ */

exports.zipMany = zipMany;
exports.zipNonEmpty = zipNonEmpty;
const zipAll = collection => {
const arrays = Array.from(collection);
const zipNonEmptyWith = (that, f) => self => {
const cs = [f(headNonEmpty(self), headNonEmpty(that))];
const len = Math.min(self.length, that.length);
if (arrays.length === 0) {
return [];
for (let i = 1; i < len; i++) {
cs[i] = f(self[i], that[i]);
}
return zipMany(arrays.slice(1))(arrays[0]);
return cs;
};

@@ -1030,7 +860,3 @@ /**

*
* @exampleTodo
* import { unzip } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.deepStrictEqual(unzip([[1, 'a'], [2, 'b'], [3, 'c']]), [[1, 2, 3], ['a', 'b', 'c']])
*
* @category mutations
* @since 1.0.0

@@ -1040,16 +866,7 @@ */

exports.zipAll = zipAll;
exports.zipNonEmptyWith = zipNonEmptyWith;
const unzip = as => {
const fa = [];
const fb = [];
for (let i = 0; i < as.length; i++) {
fa[i] = as[i][0];
fb[i] = as[i][1];
}
return [fa, fb];
};
const unzip = self => isNonEmpty(self) ? unzipNonEmpty(self) : [[], []];
/**
* @category mutations
* @since 1.0.0

@@ -1061,18 +878,17 @@ */

const product = that => self => {
if (isEmpty(self) || isEmpty(that)) {
return empty;
}
const unzipNonEmpty = self => {
const fa = [self[0][0]];
const fb = [self[0][1]];
const out = [];
for (let i = 0; i < self.length; i++) {
for (let j = 0; j < that.length; j++) {
out.push([self[i], that[j]]);
}
for (let i = 1; i < self.length; i++) {
fa[i] = self[i][0];
fb[i] = self[i][1];
}
return out;
return [fa, fb];
};
/**
* Places an element in between members of a `ReadonlyArray`
*
* @category mutations
* @since 1.0.0

@@ -1082,6 +898,9 @@ */

exports.product = product;
exports.unzipNonEmpty = unzipNonEmpty;
const cross = fb => product(fb);
const intersperse = middle => self => isNonEmpty(self) ? intersperseNonEmpty(middle)(self) : self;
/**
* Places an element in between members of a `NonEmptyReadonlyArray`
*
* @category mutations
* @since 1.0.0

@@ -1091,22 +910,14 @@ */

exports.cross = cross;
exports.intersperse = intersperse;
const productMany = collection => self => {
if (isEmpty(self)) {
return empty;
}
const intersperseNonEmpty = middle => self => {
const out = [headNonEmpty(self)];
const tail = tailNonEmpty(self);
const arrays = Array.from(collection);
const out = [];
for (let i = 0; i < self.length; i++) {
const inner = [self[i]];
for (const array of arrays) {
for (let j = 0; j < array.length; j++) {
inner.push(array[j]);
}
for (let i = 0; i < tail.length; i++) {
if (i < tail.length) {
out.push(middle);
}
out.push(inner);
out.push(tail[i]);
}

@@ -1117,2 +928,5 @@

/**
* Apply a function to the head, creating a new `NonEmptyReadonlyArray`.
*
* @category mutations
* @since 1.0.0

@@ -1122,22 +936,20 @@ */

exports.productMany = productMany;
exports.intersperseNonEmpty = intersperseNonEmpty;
const productAll = collection => {
const arrays = Array.from(collection);
const modifyNonEmptyHead = f => self => [f(headNonEmpty(self)), ...tailNonEmpty(self)];
/**
* Change the head, creating a new `NonEmptyReadonlyArray`.
*
* @category mutations
* @since 1.0.0
*/
if (isEmpty(arrays)) {
return empty;
}
return productMany(arrays.slice(1))(arrays[0]);
};
exports.modifyNonEmptyHead = modifyNonEmptyHead;
const updateNonEmptyHead = b => modifyNonEmptyHead(() => b);
/**
* Prepend an element to every member of a `ReadonlyArray`
* Apply a function to the last element, creating a new `NonEmptyReadonlyArray`.
*
* @exampleTodo
* import { prependAll } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2, 3, 4], prependAll(9)), [9, 1, 9, 2, 9, 3, 9, 4])
*
* @category mutations
* @since 1.0.0

@@ -1147,17 +959,9 @@ */

exports.productAll = productAll;
exports.updateNonEmptyHead = updateNonEmptyHead;
const prependAll = middle => {
const f = nonEmptyReadonlyArray.prependAll(middle);
return as => isNonEmpty(as) ? f(as) : as;
};
const modifyNonEmptyLast = f => self => (0, _Function.pipe)(initNonEmpty(self), append(f(lastNonEmpty(self))));
/**
* Places an element in between members of a `ReadonlyArray`
* Change the last element, creating a new `NonEmptyReadonlyArray`.
*
* @exampleTodo
* import { intersperse } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2, 3, 4], intersperse(9)), [1, 9, 2, 9, 3, 9, 4])
*
* @category mutations
* @since 1.0.0

@@ -1167,17 +971,20 @@ */

exports.prependAll = prependAll;
exports.modifyNonEmptyLast = modifyNonEmptyLast;
const intersperse = middle => {
const f = nonEmptyReadonlyArray.intersperse(middle);
return as => isNonEmpty(as) ? f(as) : as;
};
const updateNonEmptyLast = b => modifyNonEmptyLast(() => b);
/**
* Rotate a `ReadonlyArray` by `n` steps.
*
* @exampleTodo
* import { rotate } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* @category mutations
* @since 1.0.0
*/
exports.updateNonEmptyLast = updateNonEmptyLast;
const rotate = n => self => isNonEmpty(self) ? rotateNonEmpty(n)(self) : self;
/**
* Rotate a `NonEmptyReadonlyArray` by `n` steps.
*
* assert.deepStrictEqual(rotate(2)([1, 2, 3, 4, 5]), [4, 5, 1, 2, 3])
* assert.deepStrictEqual(rotate(-2)([1, 2, 3, 4, 5]), [3, 4, 5, 1, 2])
*
* @category mutations
* @since 1.0.0

@@ -1187,7 +994,18 @@ */

exports.intersperse = intersperse;
exports.rotate = rotate;
const rotate = n => {
const f = nonEmptyReadonlyArray.rotate(n);
return as => isNonEmpty(as) ? f(as) : as;
const rotateNonEmpty = n => self => {
const len = self.length;
const m = Math.round(n) % len;
if (isOutOfBound(Math.abs(m), self) || m === 0) {
return self;
}
if (m < 0) {
const [f, s] = splitNonEmptyAt(-m)(self);
return appendAllNonEmpty(f)(s);
} else {
return rotateNonEmpty(m - len)(self);
}
};

@@ -1197,10 +1015,3 @@ /**

*
* @exampleTodo
* import { elem } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as N from '@fp-ts/core/typeclass/data/number'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.strictEqual(pipe([1, 2, 3], elem(N.Eq)(2)), true)
* assert.strictEqual(pipe([1, 2, 3], elem(N.Eq)(0)), false)
*
* @category predicates
* @since 1.0.0

@@ -1210,10 +1021,10 @@ */

exports.rotate = rotate;
exports.rotateNonEmpty = rotateNonEmpty;
const elem = a => as => {
const elem = b => self => {
let i = 0;
const len = as.length;
const len = self.length;
for (; i < len; i++) {
if ((0, _Equal.equals)(a, as[i])) {
if ((0, _Equal.equals)(b, self[i])) {
return true;

@@ -1228,8 +1039,3 @@ }

*
* @exampleTodo
* import { uniq } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as N from '@fp-ts/core/typeclass/data/number'
*
* assert.deepStrictEqual(uniq(N.Eq)([1, 2, 1]), [1, 2])
*
* @category mutations
* @since 1.0.0

@@ -1241,31 +1047,7 @@ */

const uniq = self => isNonEmpty(self) ? nonEmptyReadonlyArray.uniq(self) : self;
const uniq = self => isNonEmpty(self) ? uniqNonEmpty(self) : self;
/**
* Sort the elements of a `ReadonlyArray` in increasing order, where elements are compared using first `ords[0]`, then `ords[1]`,
* etc...
* Remove duplicates from a `NonEmptyReadonlyArray`, keeping the first occurrence of an element.
*
* @exampleTodo
* import { sortBy } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { contramap } from '@fp-ts/core/typeclass/Order'
* import * as S from '@fp-ts/core/typeclass/data/string'
* import * as N from '@fp-ts/core/typeclass/data/number'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* interface Person {
* name: string
* age: number
* }
* const byName = pipe(S.Order, contramap((p: Person) => p.name))
* const byAge = pipe(N.Order, contramap((p: Person) => p.age))
*
* const sortByNameByAge = sortBy([byName, byAge])
*
* const persons = [{ name: 'a', age: 1 }, { name: 'b', age: 3 }, { name: 'c', age: 2 }, { name: 'b', age: 2 }]
* assert.deepStrictEqual(sortByNameByAge(persons), [
* { name: 'a', age: 1 },
* { name: 'b', age: 2 },
* { name: 'b', age: 3 },
* { name: 'c', age: 2 }
* ])
*
* @category mutations
* @since 1.0.0

@@ -1277,5 +1059,17 @@ */

const sortBy = orders => {
const f = nonEmptyReadonlyArray.sortBy(orders);
return as => isNonEmpty(as) ? f(as) : as;
const uniqNonEmpty = self => {
if (self.length === 1) {
return self;
}
const out = [headNonEmpty(self)];
const rest = tailNonEmpty(self);
for (const a of rest) {
if (out.every(o => !(0, _Equal.equals)(o)(a))) {
out.push(a);
}
}
return out;
};

@@ -1287,13 +1081,14 @@ /**

*
* @exampleTodo
* import { Eq } from '@fp-ts/core/typeclass/typeclasses/Eq'
* import * as N from '@fp-ts/core/typeclass/data/number'
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
* @since 1.0.0
*/
exports.uniqNonEmpty = uniqNonEmpty;
const chop = f => self => isNonEmpty(self) ? chopNonEmpty(f)(self) : empty;
/**
* A useful recursion pattern for processing a `NonEmptyReadonlyArray` to produce a new `NonEmptyReadonlyArray`, often used for "chopping" up the input
* `NonEmptyReadonlyArray`. Typically `chop` is called with some function that will consume an initial prefix of the `NonEmptyReadonlyArray` and produce a
* value and the tail of the `NonEmptyReadonlyArray`.
*
* const group = <A>(E: Eq<A>): ((as: ReadonlyArray<A>) => ReadonlyArray<ReadonlyArray<A>>) => {
* return RA.chop(as => pipe(as, RA.spanLeft(E.equals(as[0]))))
* }
* assert.deepStrictEqual(group(N.Eq)([1, 1, 2, 3, 3, 4]), [[1, 1], [2], [3, 3], [4]])
*
* @since 1.0.0

@@ -1303,7 +1098,16 @@ */

exports.sortBy = sortBy;
exports.chop = chop;
const chop = f => {
const g = nonEmptyReadonlyArray.chop(f);
return as => isNonEmpty(as) ? g(as) : empty;
const chopNonEmpty = f => self => {
const [b, rest] = f(self);
const out = [b];
let next = rest;
while (internal.isNonEmpty(next)) {
const [b, rest] = f(next);
out.push(b);
next = rest;
}
return out;
};

@@ -1313,7 +1117,14 @@ /**

*
* @exampleTodo
* import { splitAt } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* @category getters
* @since 1.0.0
*/
exports.chopNonEmpty = chopNonEmpty;
const splitAt = n => self => n >= 1 && isNonEmpty(self) ? splitNonEmptyAt(n)(self) : isEmpty(self) ? [self, empty] : [empty, self];
/**
* Splits a `NonEmptyReadonlyArray` into two pieces, the first piece has max `n` elements.
*
* assert.deepStrictEqual(splitAt(2)([1, 2, 3, 4, 5]), [[1, 2], [3, 4, 5]])
*
* @category getters
* @since 1.0.0

@@ -1323,5 +1134,8 @@ */

exports.chop = chop;
exports.splitAt = splitAt;
const splitAt = n => as => n >= 1 && isNonEmpty(as) ? nonEmptyReadonlyArray.splitAt(n)(as) : isEmpty(as) ? [as, empty] : [empty, as];
const splitNonEmptyAt = n => self => {
const m = Math.max(1, n);
return m >= self.length ? [self, internal.empty] : [(0, _Function.pipe)(self.slice(1, m), prepend(headNonEmpty(self))), self.slice(m)];
};
/**

@@ -1338,7 +1152,26 @@ * Splits a `ReadonlyArray` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of

*
* @exampleTodo
* import { chunksOf } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* @category getters
* @since 1.0.0
*/
exports.splitNonEmptyAt = splitNonEmptyAt;
const chunksOf = n => self => isNonEmpty(self) ? chunksOfNonEmpty(n)(self) : empty;
/**
* Splits a `NonEmptyReadonlyArray` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of
* the `NonEmptyReadonlyArray`.
*
* assert.deepStrictEqual(chunksOf(2)([1, 2, 3, 4, 5]), [[1, 2], [3, 4], [5]])
* @category getters
* @since 1.0.0
*/
exports.chunksOf = chunksOf;
const chunksOfNonEmpty = n => chopNonEmpty(splitNonEmptyAt(n));
/**
* Group equal, consecutive elements of a `NonEmptyReadonlyArray` into `NonEmptyReadonlyArray`s.
*
* @category grouping
* @since 1.0.0

@@ -1348,18 +1181,26 @@ */

exports.splitAt = splitAt;
exports.chunksOfNonEmpty = chunksOfNonEmpty;
const chunksOf = n => {
const f = nonEmptyReadonlyArray.chunksOf(n);
return as => isNonEmpty(as) ? f(as) : empty;
};
const group = self => (0, _Function.pipe)(self, chopNonEmpty(as => {
const h = headNonEmpty(as);
const out = [h];
let i = 1;
for (; i < as.length; i++) {
const a = as[i];
if ((0, _Equal.equals)(a, h)) {
out.push(a);
} else {
break;
}
}
return [out, as.slice(i)];
}));
/**
* Creates a `ReadonlyArray` of unique values, in order, from all given `ReadonlyArray`s using a `Eq` for equality comparisons.
* Splits an array into sub-non-empty-arrays stored in an object, based on the result of calling a `string`-returning
* function on each element, and grouping the results according to values returned
*
* @exampleTodo
* import { union } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as N from '@fp-ts/core/typeclass/data/number'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2], union(N.Eq)([2, 3])), [1, 2, 3])
*
* @category grouping
* @since 1.0.0

@@ -1369,16 +1210,39 @@ */

exports.chunksOf = chunksOf;
exports.group = group;
const union = that => self => isNonEmpty(self) && isNonEmpty(that) ? nonEmptyReadonlyArray.union(that)(self) : isNonEmpty(self) ? self : that;
const groupBy = f => self => {
const out = {};
for (const a of self) {
const k = f(a);
if (internal.has.call(out, k)) {
out[k].push(a);
} else {
out[k] = [a];
}
}
return out;
};
/**
* @category mutations
* @since 1.0.0
*/
exports.groupBy = groupBy;
const union = that => self => isNonEmpty(self) && isNonEmpty(that) ? unionNonEmpty(that)(self) : isNonEmpty(self) ? self : that;
exports.union = union;
function unionNonEmpty(that) {
return self => uniqNonEmpty(appendAllNonEmpty(that)(self));
}
/**
* Creates a `ReadonlyArray` of unique values that are included in all given `ReadonlyArray`s using a `Eq` for equality
* comparisons. The order and references of result values are determined by the first `ReadonlyArray`.
*
* @exampleTodo
* import { intersection } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as N from '@fp-ts/core/typeclass/data/number'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2], intersection(N.Eq)([2, 3])), [2])
*
* @category mutations
* @since 1.0.0

@@ -1388,4 +1252,2 @@ */

exports.union = union;
const intersection = that => self => self.filter(a => elem(a)(that));

@@ -1396,9 +1258,3 @@ /**

*
* @exampleTodo
* import { difference } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as N from '@fp-ts/core/typeclass/data/number'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(pipe([1, 2], difference(N.Eq)([2, 3])), [1])
*
* @category mutations
* @since 1.0.0

@@ -1420,27 +1276,14 @@ */

exports.difference = difference;
const of = nonEmptyReadonlyArray.of;
const of = a => [a];
/**
* @category constructors
* @since 1.0.0
*/
exports.of = of;
const empty = internal.empty;
/**
* Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to
* types of kind `* -> *`.
*
* In case of `ReadonlyArray` concatenates the inputs into a single array.
*
* @exampleTodo
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(
* pipe(
* [1, 2, 3],
* RA.orElse([4, 5])
* ),
* [1, 2, 3, 4, 5]
* )
*
* @category mapping
* @since 1.0.0

@@ -1451,6 +1294,4 @@ */

const orElse = that => self => self.concat(that);
const map = f => mapWithIndex(a => f(a));
/**
* Returns an effect whose success is mapped by the specified `f` function.
*
* @category mapping

@@ -1461,7 +1302,32 @@ * @since 1.0.0

exports.orElse = orElse;
exports.map = map;
const map = f => fa => fa.map(a => f(a)); // <= intended eta expansion
const mapNonEmpty = f => mapNonEmptyWithIndex(f);
/**
* @category mapping
* @since 1.0.0
*/
exports.mapNonEmpty = mapNonEmpty;
const mapWithIndex = f => self => self.map((a, i) => f(a, i));
/**
* @category mapping
* @since 1.0.0
*/
exports.mapWithIndex = mapWithIndex;
const mapNonEmptyWithIndex = f => self => {
const out = [f(headNonEmpty(self), 0)];
for (let i = 1; i < self.length; i++) {
out.push(f(self[i], i));
}
return out;
};
/**
* @category instances

@@ -1472,3 +1338,3 @@ * @since 1.0.0

exports.map = map;
exports.mapNonEmptyWithIndex = mapNonEmptyWithIndex;
const Of = {

@@ -1478,2 +1344,3 @@ of

/**
* @category do notation
* @since 1.0.0

@@ -1483,2 +1350,9 @@ */

exports.Of = Of;
const Do = /*#__PURE__*/of_.Do(Of);
/**
* @category mapping
* @since 1.0.0
*/
exports.Do = Do;
const imap = /*#__PURE__*/covariant.imap(map);

@@ -1495,2 +1369,3 @@ /**

/**
* @category instances
* @since 1.0.0

@@ -1500,21 +1375,14 @@ */

exports.Invariant = Invariant;
const tupled = /*#__PURE__*/invariant.tupled(Invariant);
/**
* @category do notation
* @since 1.0.0
*/
const Covariant = /*#__PURE__*/covariant.make(map);
exports.Covariant = Covariant;
const let_ = /*#__PURE__*/covariant.let(Covariant);
exports.let = let_;
exports.tupled = tupled;
const bindTo = /*#__PURE__*/invariant.bindTo(Invariant);
/**
* @category instances
* @category mapping
* @since 1.0.0
*/
exports.bindTo = bindTo;
const Covariant = { ...Invariant,
map
};
const flap = /*#__PURE__*/covariant.flap(Covariant);
/**
* Returns the effect resulting from mapping the success of this effect to unit.
* Maps the success value of this effect to the specified constant value.
*

@@ -1525,4 +1393,4 @@ * @category mapping

exports.Covariant = Covariant;
const asUnit = /*#__PURE__*/covariant.asUnit(Covariant);
exports.flap = flap;
const as = /*#__PURE__*/covariant.as(Covariant);
/**

@@ -1533,3 +1401,3 @@ * @category instances

exports.asUnit = asUnit;
exports.as = as;
const Pointed = { ...Of,

@@ -1539,21 +1407,2 @@ ...Covariant

/**
* @exampleTodo
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(
* pipe(
* [1, 2, 3],
* RA.flatMap((n) => [`a${n}`, `b${n}`])
* ),
* ['a1', 'b1', 'a2', 'b2', 'a3', 'b3']
* )
* assert.deepStrictEqual(
* pipe(
* [1, 2, 3],
* RA.flatMap(() => [])
* ),
* []
* )
*
* @category sequencing

@@ -1565,5 +1414,17 @@ * @since 1.0.0

const flatMap = f => flatMapWithIndex((_, a) => f(a));
const flatMapWithIndex = f => self => {
if (isEmpty(self)) {
return empty;
}
const out = [];
for (let i = 0; i < self.length; i++) {
out.push(...f(self[i], i));
}
return out;
};
/**
* @category instances
* @category sequencing
* @since 1.0.0

@@ -1573,18 +1434,31 @@ */

exports.flatMap = flatMap;
const FlatMap = {
flatMap
};
exports.flatMapWithIndex = flatMapWithIndex;
const flatMap = f => flatMapWithIndex(f);
/**
* @category sequencing
* @since 1.0.0
*/
exports.FlatMap = FlatMap;
const andThen = /*#__PURE__*/flatMap_.andThen(FlatMap);
exports.flatMap = flatMap;
const flatMapNonEmptyWithIndex = f => self => {
const out = internal.fromNonEmptyReadonlyArray(f(headNonEmpty(self), 0));
for (let i = 1; i < self.length; i++) {
out.push(...f(self[i], i));
}
return out;
};
/**
* @category sequencing
* @since 1.0.0
*/
exports.andThen = andThen;
const composeKleisliArrow = /*#__PURE__*/flatMap_.composeKleisliArrow(FlatMap);
exports.flatMapNonEmptyWithIndex = flatMapNonEmptyWithIndex;
const flatMapNonEmpty = f => flatMapNonEmptyWithIndex(f);
/**

@@ -1595,10 +1469,8 @@ * @category instances

exports.composeKleisliArrow = composeKleisliArrow;
const Chainable = { ...FlatMap,
...Covariant
exports.flatMapNonEmpty = flatMapNonEmpty;
const FlatMap = {
flatMap
};
/**
* Sequences the specified effect after this effect, but ignores the value
* produced by the effect.
*
* @category sequencing

@@ -1608,11 +1480,11 @@ * @since 1.0.0

exports.Chainable = Chainable;
const andThenDiscard = /*#__PURE__*/chainable.andThenDiscard(Chainable);
exports.FlatMap = FlatMap;
const flatten = /*#__PURE__*/flatMap_.flatten(FlatMap);
/**
* @category do notation
* @category sequencing
* @since 1.0.0
*/
exports.andThenDiscard = andThenDiscard;
const bind = /*#__PURE__*/chainable.bind(Chainable);
exports.flatten = flatten;
const flattenNonEmpty = /*#__PURE__*/flatMapNonEmpty(_Function.identity);
/**

@@ -1622,47 +1494,21 @@ * @since 1.0.0

exports.bind = bind;
const ap = fa => fb => (0, _Function.pipe)(fb, flatMap(f => (0, _Function.pipe)(fa, map(a => f(a)))));
exports.flattenNonEmpty = flattenNonEmpty;
const composeKleisliArrow = /*#__PURE__*/flatMap_.composeKleisliArrow(FlatMap);
/**
* @category instances
* @since 1.0.0
*/
exports.ap = ap;
const flatMapWithIndex = f => as => {
if (isEmpty(as)) {
return empty;
}
const out = [];
for (let i = 0; i < as.length; i++) {
out.push(...f(i, as[i]));
}
return out;
exports.composeKleisliArrow = composeKleisliArrow;
const Chainable = { ...FlatMap,
...Covariant
};
/**
* Removes one level of nesting
*
* @exampleTodo
* import { flatten } from '@fp-ts/core/typeclass/data/ReadonlyArray'
*
* assert.deepStrictEqual(flatten([[1], [2, 3], [4]]), [1, 2, 3, 4])
*
* @category do notation
* @since 1.0.0
*/
exports.flatMapWithIndex = flatMapWithIndex;
const flatten = /*#__PURE__*/flatMap(_Function.identity);
exports.Chainable = Chainable;
const bind = /*#__PURE__*/chainable.bind(Chainable);
/**
* @since 1.0.0
*/
exports.flatten = flatten;
const mapWithIndex = f => self => self.map(f);
/**
* @category filtering

@@ -1672,11 +1518,10 @@ * @since 1.0.0

exports.bind = bind;
exports.mapWithIndex = mapWithIndex;
const filterMapWithIndex = f => self => {
const as = internal.fromIterable(self);
const as = fromIterable(self);
const out = [];
for (let i = 0; i < as.length; i++) {
const o = f(i, as[i]);
const o = f(as[i], i);

@@ -1698,3 +1543,3 @@ if (internal.isSome(o)) {

const filterMap = f => filterMapWithIndex((_, a) => f(a));
const filterMap = f => filterMapWithIndex(f);
/**

@@ -1709,3 +1554,3 @@ * @category filtering

/**
* @category filtering
* @category instances
* @since 1.0.0

@@ -1715,3 +1560,12 @@ */

exports.compact = compact;
const Compactable = {
compact
};
/**
* @category filtering
* @since 1.0.0
*/
exports.Compactable = Compactable;
const separate = fa => {

@@ -1732,3 +1586,3 @@ const left = [];

/**
* @category filtering
* @category instances
* @since 1.0.0

@@ -1739,4 +1593,12 @@ */

exports.separate = separate;
const Filterable = {
filterMap
};
/**
* @category filtering
* @since 1.0.0
*/
const partitionMap = f => partitionMapWithIndex((_, a) => f(a));
exports.Filterable = Filterable;
const filter = /*#__PURE__*/filterable.filter(Filterable);
/**

@@ -1747,3 +1609,36 @@ * @category filtering

exports.filter = filter;
const filterWithIndex = predicate => filterMapWithIndex((b, i) => predicate(b, i) ? internal.some(b) : internal.none);
/**
* @category filtering
* @since 1.0.0
*/
exports.filterWithIndex = filterWithIndex;
const partition = /*#__PURE__*/filterable.partition(Filterable);
/**
* @category filtering
* @since 1.0.0
*/
exports.partition = partition;
const partitionWithIndex = predicate => partitionMapWithIndex((b, i) => predicate(b, i) ? either.right(b) : either.left(b));
/**
* @category filtering
* @since 1.0.0
*/
exports.partitionWithIndex = partitionWithIndex;
const partitionMap = f => partitionMapWithIndex(f);
/**
* @category filtering
* @since 1.0.0
*/
exports.partitionMap = partitionMap;

@@ -1756,3 +1651,3 @@

for (let i = 0; i < fa.length; i++) {
const e = f(i, fa[i]);
const e = f(fa[i], i);

@@ -1769,2 +1664,3 @@ if (either.isLeft(e)) {

/**
* @category traversing
* @since 1.0.0

@@ -1776,3 +1672,3 @@ */

const extend = f => wa => wa.map((_, i, as) => f(as.slice(i)));
const traverse = F => f => traverseWithIndex(F)(f);
/**

@@ -1784,3 +1680,3 @@ * @category traversing

exports.extend = extend;
exports.traverse = traverse;

@@ -1796,4 +1692,5 @@ const traverseWithIndex = F => f => self => F.productAll(self.map(f));

const traverse = F => f => traverseWithIndex(F)(f);
const traverseNonEmpty = F => f => traverseNonEmptyWithIndex(F)(f);
/**
* @category traversing
* @since 1.0.0

@@ -1803,22 +1700,10 @@ */

exports.traverse = traverse;
exports.traverseNonEmpty = traverseNonEmpty;
const unfold = (b, f) => {
const out = [];
let next = b;
let o;
while (internal.isSome(o = f(next))) {
const [a, b] = o.value;
out.push(a);
next = b;
}
return out;
}; // -------------------------------------------------------------------------------------
// instances
// -------------------------------------------------------------------------------------
const traverseNonEmptyWithIndex = F => f => self => {
const fbs = (0, _Function.pipe)(self, mapNonEmptyWithIndex(f));
return (0, _Function.pipe)(headNonEmpty(fbs), F.productMany(tailNonEmpty(fbs)));
};
/**
* @category instances
* @category traversing
* @since 1.0.0

@@ -1828,5 +1713,4 @@ */

exports.unfold = unfold;
const getUnionSemigroup = () => (0, _Semigroup.fromCombine)(union);
exports.traverseNonEmptyWithIndex = traverseNonEmptyWithIndex;
const sequence = /*#__PURE__*/traversable.sequence(traverse);
/**

@@ -1837,45 +1721,23 @@ * @category instances

exports.getUnionSemigroup = getUnionSemigroup;
const getUnionMonoid = () => {
const S = getUnionSemigroup();
return {
combine: S.combine,
combineMany: S.combineMany,
combineAll: all => S.combineMany(all)(empty),
empty
};
exports.sequence = sequence;
const Traversable = {
traverse,
sequence
};
/**
* @category instances
* @category traversing
* @since 1.0.0
*/
exports.getUnionMonoid = getUnionMonoid;
const getIntersectionSemigroup = () => (0, _Semigroup.fromCombine)(intersection);
exports.Traversable = Traversable;
const traverseTap = /*#__PURE__*/traversable.traverseTap(Traversable);
/**
* Returns a `Semigroup` for `ReadonlyArray<A>`.
*
* @exampleTodo
* import { getSemigroup } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const S = getSemigroup<number>()
* assert.deepStrictEqual(pipe([1, 2], S.combine([3, 4])), [1, 2, 3, 4])
*
* @category instances
* @category traversing
* @since 1.0.0
*/
exports.traverseTap = traverseTap;
exports.getIntersectionSemigroup = getIntersectionSemigroup;
const getSemigroup = () => (0, _Semigroup.fromCombine)(concat);
const sequenceNonEmpty = F => traverseNonEmpty(F)(_Function.identity);
/**
* Returns a `Monoid` for `ReadonlyArray<A>`.
*
* @category instances
* @since 1.0.0

@@ -1885,53 +1747,20 @@ */

exports.getSemigroup = getSemigroup;
exports.sequenceNonEmpty = sequenceNonEmpty;
const getMonoid = () => {
const S = getSemigroup();
return {
combine: S.combine,
combineMany: S.combineMany,
combineAll: all => S.combineMany(all)(empty),
empty
};
};
/**
* Derives an `Order` over the `ReadonlyArray` of a given element type from the `Order` of that type. The ordering between two such
* `ReadonlyArray`s is equal to: the first non equal comparison of each `ReadonlyArray`s elements taken pairwise in increasing order, in
* case of equality over all the pairwise elements; the longest `ReadonlyArray` is considered the greatest, if both `ReadonlyArray`s have
* the same length, the result is equality.
*
* @exampleTodo
* import { liftOrder } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as S from '@fp-ts/core/typeclass/data/string'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const O = liftOrder(S.Order)
* assert.strictEqual(pipe(['b'], O.compare(['a'])), 1)
* assert.strictEqual(pipe(['a'], O.compare(['a'])), 0)
* assert.strictEqual(pipe(['a'], O.compare(['b'])), -1)
*
* @category instances
* @since 1.0.0
*/
const product = that => self => {
if (isEmpty(self) || isEmpty(that)) {
return empty;
}
const out = [];
exports.getMonoid = getMonoid;
const liftOrder = O => order.fromCompare(that => self => {
const aLen = self.length;
const bLen = that.length;
const len = Math.min(aLen, bLen);
for (let i = 0; i < len; i++) {
const o = O.compare(that[i])(self[i]);
if (o !== 0) {
return o;
for (let i = 0; i < self.length; i++) {
for (let j = 0; j < that.length; j++) {
out.push([self[i], that[j]]);
}
}
return number.Order.compare(bLen)(aLen);
});
return out;
};
/**
* @category mapping
* @since 1.0.0

@@ -1941,13 +1770,19 @@ */

exports.liftOrder = liftOrder;
const flap = /*#__PURE__*/covariant.flap(Covariant);
exports.product = product;
const productMany = /*#__PURE__*/nonEmptyProduct.productMany(Covariant, product);
/**
* Maps the success value of this effect to the specified constant value.
*
* @category mapping
* @since 1.0.0
*/
exports.flap = flap;
const as = /*#__PURE__*/covariant.as(Covariant);
exports.productMany = productMany;
const productAll = collection => {
const arrays = Array.from(collection);
if (isEmpty(arrays)) {
return empty;
}
return productMany(arrays.slice(1))(arrays[0]);
};
/**

@@ -1958,3 +1793,4 @@ * @category instances

exports.as = as;
exports.productAll = productAll;
const NonEmptyProduct = { ...Invariant,

@@ -1965,2 +1801,11 @@ product,

/**
* A variant of `bind` that sequentially ignores the scope.
*
* @category do notation
* @since 1.0.0
*/
exports.NonEmptyProduct = NonEmptyProduct;
const bindReadonlyArray = /*#__PURE__*/nonEmptyProduct.bindKind(NonEmptyProduct);
/**
* @category instances

@@ -1970,3 +1815,3 @@ * @since 1.0.0

exports.NonEmptyProduct = NonEmptyProduct;
exports.bindReadonlyArray = bindReadonlyArray;
const NonEmptyApplicative = { ...NonEmptyProduct,

@@ -1976,2 +1821,8 @@ ...Covariant

/**
* @since 1.0.0
*/
exports.NonEmptyApplicative = NonEmptyApplicative;
const ap = /*#__PURE__*/nonEmptyApplicative.ap(NonEmptyApplicative);
/**
* Lifts a binary function into `ReadonlyArray`.

@@ -1983,3 +1834,3 @@ *

exports.NonEmptyApplicative = NonEmptyApplicative;
exports.ap = ap;
const lift2 = /*#__PURE__*/nonEmptyApplicative.lift2(NonEmptyApplicative);

@@ -1996,2 +1847,3 @@ /**

/**
* @category lifting
* @since 1.0.0

@@ -2022,2 +1874,3 @@ */

/**
* @category lifting
* @since 1.0.0

@@ -2038,23 +1891,3 @@ */

/**
* Returns an effect that effectfully "peeks" at the success of this effect.
*
* @exampleTodo
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* assert.deepStrictEqual(
* pipe(
* [1, 2, 3],
* RA.tap(() => ['a', 'b'])
* ),
* [1, 1, 2, 2, 3, 3]
* )
* assert.deepStrictEqual(
* pipe(
* [1, 2, 3],
* RA.tap(() => [])
* ),
* []
* )
*
* @category folding
* @since 1.0.0

@@ -2064,54 +1897,14 @@ */

exports.Monad = Monad;
const tap = /*#__PURE__*/chainable.tap(Chainable);
/**
* @category instances
* @since 1.0.0
*/
exports.tap = tap;
const Compactable = {
compact
};
const reduce = (b, f) => self => self.reduce((b, a) => f(b, a), b);
/**
* @category instances
* @category folding
* @since 1.0.0
*/
exports.Compactable = Compactable;
const Filterable = {
filterMap
}; // TODO: perf
/**
* @category filtering
* @since 1.0.0
*/
exports.reduce = reduce;
exports.Filterable = Filterable;
const filter = /*#__PURE__*/filterable.filter(Filterable);
const reduceWithIndex = (b, f) => self => self.reduce((b, a, i) => f(b, a, i), b);
/**
* @category filtering
* @since 1.0.0
*/
exports.filter = filter;
const partition = /*#__PURE__*/filterable.partition(Filterable);
/**
* @category filtering
* @since 1.0.0
*/
exports.partition = partition;
const filterWithIndex = predicate => filterMapWithIndex((i, b) => predicate(i, b) ? internal.some(b) : internal.none);
/**
* @category filtering
* @since 1.0.0
*/
exports.filterWithIndex = filterWithIndex;
const partitionWithIndex = predicate => partitionMapWithIndex((i, b) => predicate(i, b) ? either.right(b) : either.left(b));
/**
* @category folding

@@ -2122,5 +1915,5 @@ * @since 1.0.0

exports.partitionWithIndex = partitionWithIndex;
exports.reduceWithIndex = reduceWithIndex;
const reduce = (b, f) => self => self.reduce((b, a) => f(b, a), b);
const reduceRight = (b, f) => self => self.reduceRight((b, a) => f(b, a), b);
/**

@@ -2132,5 +1925,5 @@ * @category folding

exports.reduce = reduce;
exports.reduceRight = reduceRight;
const reduceRight = (b, f) => self => self.reduceRight((b, a) => f(b, a), b);
const reduceRightWithIndex = (b, f) => self => self.reduceRight((b, a, i) => f(b, a, i), b);
/**

@@ -2142,6 +1935,5 @@ * @category instances

exports.reduceRight = reduceRight;
exports.reduceRightWithIndex = reduceRightWithIndex;
const Foldable = {
reduce,
reduceRight
reduce
};

@@ -2161,10 +1953,4 @@ /**

exports.foldMap = foldMap;
const reduceKind = /*#__PURE__*/foldable.reduceKind(Foldable);
/**
* @category folding
* @since 1.0.0
*/
exports.reduceKind = reduceKind;
const reduceRightKind = /*#__PURE__*/foldable.reduceRightKind(Foldable);
const foldMapWithIndex = Monoid => f => self => self.reduce((m, a, i) => Monoid.combine(f(a, i))(m), Monoid.empty);
/**

@@ -2175,12 +1961,6 @@ * @category folding

exports.reduceRightKind = reduceRightKind;
const foldMapKind = /*#__PURE__*/foldable.foldMapKind(Foldable);
/**
* @category folding
* @since 1.0.0
*/
exports.foldMapKind = foldMapKind;
exports.foldMapWithIndex = foldMapWithIndex;
const reduceWithIndex = (b, f) => self => self.reduce((b, a, i) => f(i, b, a), b);
const foldMapNonEmpty = S => f => foldMapNonEmptyWithIndex(S)(f);
/**

@@ -2192,5 +1972,5 @@ * @category folding

exports.reduceWithIndex = reduceWithIndex;
exports.foldMapNonEmpty = foldMapNonEmpty;
const foldMapWithIndex = Monoid => f => self => self.reduce((m, a, i) => Monoid.combine(f(i, a))(m), Monoid.empty);
const foldMapNonEmptyWithIndex = S => f => self => tailNonEmpty(self).reduce((s, a, i) => S.combine(f(a, i + 1))(s), f(headNonEmpty(self), 0));
/**

@@ -2202,30 +1982,19 @@ * @category folding

exports.foldMapWithIndex = foldMapWithIndex;
const reduceRightWithIndex = (b, f) => self => self.reduceRight((b, a, i) => f(i, a, b), b);
exports.foldMapNonEmptyWithIndex = foldMapNonEmptyWithIndex;
const reduceKind = /*#__PURE__*/foldable.reduceKind(Foldable);
/**
* @category instances
* @category folding
* @since 1.0.0
*/
exports.reduceRightWithIndex = reduceRightWithIndex;
const Traversable = {
traverse
};
exports.reduceKind = reduceKind;
const reduceRightKind = /*#__PURE__*/foldable.reduceRightKind(Foldable);
/**
* @category traversing
* @category folding
* @since 1.0.0
*/
exports.Traversable = Traversable;
const sequence = /*#__PURE__*/traversable.sequence(Traversable);
exports.reduceRightKind = reduceRightKind;
const foldMapKind = /*#__PURE__*/foldable.foldMapKind(Foldable);
/**
* @category traversing
* @since 1.0.0
*/
exports.sequence = sequence;
const traverseTap = /*#__PURE__*/traversable.traverseTap(Traversable);
/**
* @category filtering

@@ -2235,3 +2004,3 @@ * @since 1.0.0

exports.traverseTap = traverseTap;
exports.foldMapKind = foldMapKind;
const traverseFilterMap = /*#__PURE__*/traversableFilterable.traverseFilterMap({ ...Traversable,

@@ -2263,19 +2032,2 @@ ...Compactable

*
* @exampleTodo
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
* import * as RA from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import * as T from '@fp-ts/core/typeclass/data/Async'
*
* const traverseFilter = RA.traverseFilter(T.MonoidalPar)
* async function test() {
* assert.deepStrictEqual(
* await pipe(
* [-1, 2, 3],
* traverseFilter((n) => T.of(n > 0))
* )(),
* [2, 3]
* )
* }
* test()
*
* @since 1.0.0

@@ -2351,3 +2103,3 @@ */

function every(predicate) {
return as => as.every(predicate);
return self => self.every(predicate);
}

@@ -2357,11 +2109,3 @@ /**

*
* @exampleTodo
* import { some } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* import { pipe } from '@fp-ts/core/typeclass/data/Function'
*
* const isPositive = (n: number): boolean => n > 0
*
* assert.deepStrictEqual(pipe([-1, -2, 3], some(isPositive)), true)
* assert.deepStrictEqual(pipe([-1, -2, -3], some(isPositive)), false)
*
* @category predicates
* @since 1.0.0

@@ -2371,3 +2115,3 @@ */

const some = predicate => as => as.some(predicate);
const some = predicate => self => self.some(predicate);
/**

@@ -2381,3 +2125,3 @@ * Alias of [`some`](#some)

exports.some = some;
const exists = some;
const has = some;
/**

@@ -2387,22 +2131,19 @@ * Fold a data structure, accumulating values in some `Monoid`, combining adjacent elements

*
* @exampleTodo
* import * as S from '@fp-ts/core/typeclass/data/string'
* import { intercalate } from '@fp-ts/core/typeclass/data/ReadonlyArray'
* @since 1.0.0
*/
exports.has = has;
const intercalate = M => middle => self => isNonEmpty(self) ? intercalateNonEmpty(M)(middle)(self) : M.empty;
/**
* Places an element in between members of a `NonEmptyReadonlyArray`, then folds the results using the provided `Semigroup`.
*
* assert.deepStrictEqual(intercalate(S.Monoid)('-')(['a', 'b', 'c']), 'a-b-c')
*
* @since 1.0.0
*/
exports.exists = exists;
const intercalate = M => {
const intercalateM = nonEmptyReadonlyArray.intercalate(M);
return middle => match(() => M.empty, intercalateM(middle));
}; // -------------------------------------------------------------------------------------
// do notation
// -------------------------------------------------------------------------------------
exports.intercalate = intercalate;
const intercalateNonEmpty = S => middle => self => semigroup.intercalate(middle)(S).combineMany(tailNonEmpty(self))(headNonEmpty(self));
/**
* @category do notation
* @since 1.0.0

@@ -2412,22 +2153,149 @@ */

exports.intercalate = intercalate;
const Do = /*#__PURE__*/of(internal.Do);
exports.Do = Do;
const let_ = /*#__PURE__*/covariant.let(Covariant);
exports.let = let_;
exports.intercalateNonEmpty = intercalateNonEmpty;
const productFlatten = /*#__PURE__*/nonEmptyProduct.productFlatten(NonEmptyProduct);
/**
* @since 1.0.0
*/
exports.productFlatten = productFlatten;
const extend = f => self => self.map((_, i, as) => f(as.slice(i)));
/**
* A variant of `bind` that sequentially ignores the scope.
* @since 1.0.0
*/
exports.extend = extend;
const min = O => {
const S = semigroup.min(O);
return self => self.reduce((a, acc) => S.combine(acc)(a));
};
/**
* @since 1.0.0
*/
exports.min = min;
const max = O => {
const S = semigroup.max(O);
return self => self.reduce((a, acc) => S.combine(acc)(a));
};
/**
* @category constructors
* @since 1.0.0
*/
exports.max = max;
const unfold = (b, f) => {
const out = [];
let next = b;
let o;
while (internal.isSome(o = f(next))) {
const [a, b] = o.value;
out.push(a);
next = b;
}
return out;
};
/**
* @category instances
* @since 1.0.0
*/
exports.unfold = unfold;
const getUnionSemigroup = () => (0, semigroup.fromCombine)(union);
/**
* @category instances
* @since 1.0.0
*/
exports.getUnionSemigroup = getUnionSemigroup;
const getUnionMonoid = () => {
const S = getUnionSemigroup();
return {
combine: S.combine,
combineMany: S.combineMany,
combineAll: collection => S.combineMany(collection)(empty),
empty
};
};
/**
* @category instances
* @since 1.0.0
*/
exports.getUnionMonoid = getUnionMonoid;
const getIntersectionSemigroup = () => (0, semigroup.fromCombine)(intersection);
/**
* Returns a `Semigroup` for `ReadonlyArray<A>`.
*
* @category do notation
* @category instances
* @since 1.0.0
*/
const bindReadonlyArray = /*#__PURE__*/nonEmptyProduct.bindKind(NonEmptyProduct);
exports.getIntersectionSemigroup = getIntersectionSemigroup;
const getSemigroup = () => (0, semigroup.fromCombine)(appendAll);
/**
* Returns a `Monoid` for `ReadonlyArray<A>`.
*
* @category instances
* @since 1.0.0
*/
exports.bindReadonlyArray = bindReadonlyArray;
const productFlatten = /*#__PURE__*/nonEmptyProduct.productFlatten(NonEmptyProduct);
exports.productFlatten = productFlatten;
exports.getSemigroup = getSemigroup;
const getMonoid = () => {
const S = getSemigroup();
return {
combine: S.combine,
combineMany: S.combineMany,
combineAll: collection => S.combineMany(collection)(empty),
empty
};
};
/**
* Derives an `Order` over the `ReadonlyArray` of a given element type from the `Order` of that type. The ordering between two such
* `ReadonlyArray`s is equal to: the first non equal comparison of each `ReadonlyArray`s elements taken pairwise in increasing order, in
* case of equality over all the pairwise elements; the longest `ReadonlyArray` is considered the greatest, if both `ReadonlyArray`s have
* the same length, the result is equality.
*
* @category lifting
* @since 1.0.0
*/
exports.getMonoid = getMonoid;
const liftOrder = O => order.fromCompare(that => self => {
const aLen = self.length;
const bLen = that.length;
const len = Math.min(aLen, bLen);
for (let i = 0; i < len; i++) {
const o = O.compare(that[i])(self[i]);
if (o !== 0) {
return o;
}
}
return number.Order.compare(bLen)(aLen);
});
exports.liftOrder = liftOrder;
//# sourceMappingURL=ReadonlyArray.js.map

@@ -30,4 +30,2 @@ /**

readonly _id: TypeId;
readonly _Key: (_: never) => Key;
readonly _Value: (_: never) => Value;
}

@@ -245,4 +243,4 @@ /**

*/
export declare const reduceWithIndex: <Z, K, V>(zero: Z, f: (accumulator: Z, key: K, value: V) => Z) => (self: RedBlackTree<K, V>) => Z;
export declare const reduceWithIndex: <B, A, K>(b: B, f: (b: B, value: A, key: K) => B) => (self: RedBlackTree<K, A>) => B;
export {};
//# sourceMappingURL=RedBlackTree.d.ts.map

@@ -19,4 +19,2 @@ /**

readonly _id: TypeId;
readonly _K: (_: never) => K;
readonly _V: (_: never) => V;
}

@@ -117,3 +115,3 @@ /**

*/
export declare const reduceWithIndex: <K, V, B>(zero: B, f: (accumulator: B, key: K, value: V) => B) => (self: SortedMap<K, V>) => B;
export declare const reduceWithIndex: <B, A, K>(b: B, f: (b: B, value: A, key: K) => B) => (self: SortedMap<K, A>) => B;
/**

@@ -123,3 +121,3 @@ * @since 1.0.0

*/
export declare const mapWithIndex: <K, A, B>(f: (k: K, a: A) => B) => (self: SortedMap<K, A>) => SortedMap<K, B>;
export declare const mapWithIndex: <A, K, B>(f: (a: A, k: K) => B) => (self: SortedMap<K, A>) => SortedMap<K, B>;
/**

@@ -126,0 +124,0 @@ * @since 1.0.0

@@ -30,6 +30,2 @@ "use strict";

this._id = TypeId;
this._K = _ => _;
this._V = _ => _;
}

@@ -217,3 +213,3 @@

const reduceWithIndex = (zero, f) => self => RBT.reduceWithIndex(zero, f)(self.tree);
const reduceWithIndex = (b, f) => self => RBT.reduceWithIndex(b, f)(self.tree);
/**

@@ -227,3 +223,3 @@ * @since 1.0.0

const mapWithIndex = f => self => (0, _Function.pipe)(self, reduceWithIndex(empty(RBT.getOrder(self.tree)), (b, k, v) => set(k, f(k, v))(b)));
const mapWithIndex = f => self => (0, _Function.pipe)(self, reduceWithIndex(empty(RBT.getOrder(self.tree)), (b, v, k) => set(k, f(v, k))(b)));
/**

@@ -237,5 +233,5 @@ * @since 1.0.0

const map = f => self => (0, _Function.pipe)(self, mapWithIndex((_, v) => f(v)));
const map = f => self => (0, _Function.pipe)(self, mapWithIndex(f));
exports.map = map;
//# sourceMappingURL=SortedMap.js.map

@@ -20,3 +20,2 @@ /**

readonly _id: TypeId;
readonly _A: (_: never) => A;
}

@@ -23,0 +22,0 @@ /**

@@ -28,4 +28,2 @@ "use strict";

this._id = TypeId;
this._A = _ => _;
}

@@ -32,0 +30,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc