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M,EACJ,OAAQA,EAAK,CAAC,GAAMF,GAAQJ,EAAGM,CACnC,GAAI,CAAG,CACX,CACA,SAASoN,EAAK5O,GACV,OAAO,SAAUsB,EAAMrB,GAAK,OAAO,SAAUQ,GAAM,OAAOT,EAAEW,IAAIF,GAAI,SAAUS,GAC1E,IAAIM,EACJ,OAAOC,OAAOC,OAAO,CAAC,EAAGR,IAAIM,EAAK,CAAC,GAAMF,GAAQrB,EAAEiB,GAAIM,GAC3D,GAAI,CAAG,CACX,CAcO,SAASY,EAAGpC,GACf,OAAO,SAAUsR,EAAMlQ,GAAK,OAAOpB,EAAEW,IAAI2Q,GAAM,WAAc,OAAOlQ,CAAG,GAAI,CAC/E,CAEO,SAAS0I,EAAO9J,GACnB,IAAI2S,EAAMvQ,EAAGpC,GACb,OAAO,SAAUsR,GAAQ,OAAOqB,EAAIrB,OAAMrI,EAAY,CAC1D,C","sources":["../node_modules/fp-ts/es6/Applicative.js","../node_modules/fp-ts/es6/Apply.js","../node_modules/fp-ts/es6/Array.js","../node_modules/fp-ts/es6/Chain.js","../node_modules/fp-ts/es6/ChainRec.js","../node_modules/fp-ts/es6/Either.js","../node_modules/fp-ts/es6/EitherT.js","../node_modules/fp-ts/es6/Eq.js","../node_modules/fp-ts/es6/FromEither.js","../node_modules/fp-ts/es6/FromIO.js","../node_modules/fp-ts/es6/FromTask.js","../node_modules/fp-ts/es6/Functor.js"],"sourcesContent":["/**\n * The `Applicative` type class extends the `Apply` type class with a `of` function, which can be used to create values\n * of type `f a` from values of type `a`.\n *\n * Where `Apply` provides the ability to lift functions of two or more arguments to functions whose arguments are\n * wrapped using `f`, and `Functor` provides the ability to lift functions of one argument, `pure` can be seen as the\n * function which lifts functions of _zero_ arguments. That is, `Applicative` functors support a lifting operation for\n * any number of function arguments.\n *\n * Instances must satisfy the following laws in addition to the `Apply` laws:\n *\n * 1. Identity: `A.ap(A.of(a => a), fa) <-> fa`\n * 2. Homomorphism: `A.ap(A.of(ab), A.of(a)) <-> A.of(ab(a))`\n * 3. Interchange: `A.ap(fab, A.of(a)) <-> A.ap(A.of(ab => ab(a)), fab)`\n *\n * Note. `Functor`'s `map` can be derived: `A.map(x, f) = A.ap(A.of(f), x)`\n *\n * @since 2.0.0\n */\nimport { ap, getApplySemigroup } from './Apply';\nimport { pipe } from './function';\nimport { getFunctorComposition } from './Functor';\nexport function getApplicativeMonoid(F) {\n var f = getApplySemigroup(F);\n return function (M) { return ({\n concat: f(M).concat,\n empty: F.of(M.empty)\n }); };\n}\n/** @deprecated */\nexport function getApplicativeComposition(F, G) {\n var map = getFunctorComposition(F, G).map;\n var _ap = ap(F, G);\n return {\n map: map,\n of: function (a) { return F.of(G.of(a)); },\n ap: function (fgab, fga) { return pipe(fgab, _ap(fga)); }\n };\n}\n","/**\n * The `Apply` class provides the `ap` which is used to apply a function to an argument under a type constructor.\n *\n * `Apply` can be used to lift functions of two or more arguments to work on values wrapped with the type constructor\n * `f`.\n *\n * Instances must satisfy the following law in addition to the `Functor` laws:\n *\n * 1. Associative composition: `F.ap(F.ap(F.map(fbc, bc => ab => a => bc(ab(a))), fab), fa) <-> F.ap(fbc, F.ap(fab, fa))`\n *\n * Formally, `Apply` represents a strong lax semi-monoidal endofunctor.\n *\n * @example\n * import * as O from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * const f = (a: string) => (b: number) => (c: boolean) => a + String(b) + String(c)\n * const fa: O.Option = O.some('s')\n * const fb: O.Option = O.some(1)\n * const fc: O.Option = O.some(true)\n *\n * assert.deepStrictEqual(\n * pipe(\n * // lift a function\n * O.some(f),\n * // apply the first argument\n * O.ap(fa),\n * // apply the second argument\n * O.ap(fb),\n * // apply the third argument\n * O.ap(fc)\n * ),\n * O.some('s1true')\n * )\n *\n * @since 2.0.0\n */\nimport { tuple } from './function';\nimport * as _ from './internal';\nexport function ap(F, G) {\n return function (fa) {\n return function (fab) {\n return F.ap(F.map(fab, function (gab) { return function (ga) { return G.ap(gab, ga); }; }), fa);\n };\n };\n}\nexport function apFirst(A) {\n return function (second) { return function (first) {\n return A.ap(A.map(first, function (a) { return function () { return a; }; }), second);\n }; };\n}\nexport function apSecond(A) {\n return function (second) {\n return function (first) {\n return A.ap(A.map(first, function () { return function (b) { return b; }; }), second);\n };\n };\n}\nexport function apS(F) {\n return function (name, fb) {\n return function (fa) {\n return F.ap(F.map(fa, function (a) { return function (b) {\n var _a;\n return Object.assign({}, a, (_a = {}, _a[name] = b, _a));\n }; }), fb);\n };\n };\n}\nexport function getApplySemigroup(F) {\n return function (S) { return ({\n concat: function (first, second) {\n return F.ap(F.map(first, function (x) { return function (y) { return S.concat(x, y); }; }), second);\n }\n }); };\n}\nfunction curried(f, n, acc) {\n return function (x) {\n var combined = Array(acc.length + 1);\n for (var i = 0; i < acc.length; i++) {\n combined[i] = acc[i];\n }\n combined[acc.length] = x;\n return n === 0 ? f.apply(null, combined) : curried(f, n - 1, combined);\n };\n}\nvar tupleConstructors = {\n 1: function (a) { return [a]; },\n 2: function (a) { return function (b) { return [a, b]; }; },\n 3: function (a) { return function (b) { return function (c) { return [a, b, c]; }; }; },\n 4: function (a) { return function (b) { return function (c) { return function (d) { return [a, b, c, d]; }; }; }; },\n 5: function (a) { return function (b) { return function (c) { return function (d) { return function (e) { return [a, b, c, d, e]; }; }; }; }; }\n};\nfunction getTupleConstructor(len) {\n if (!_.has.call(tupleConstructors, len)) {\n tupleConstructors[len] = curried(tuple, len - 1, []);\n }\n return tupleConstructors[len];\n}\nexport function sequenceT(F) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var len = args.length;\n var f = getTupleConstructor(len);\n var fas = F.map(args[0], f);\n for (var i = 1; i < len; i++) {\n fas = F.ap(fas, args[i]);\n }\n return fas;\n };\n}\nfunction getRecordConstructor(keys) {\n var len = keys.length;\n switch (len) {\n case 1:\n return function (a) {\n var _a;\n return (_a = {}, _a[keys[0]] = a, _a);\n };\n case 2:\n return function (a) { return function (b) {\n var _a;\n return (_a = {}, _a[keys[0]] = a, _a[keys[1]] = b, _a);\n }; };\n case 3:\n return function (a) { return function (b) { return function (c) {\n var _a;\n return (_a = {}, _a[keys[0]] = a, _a[keys[1]] = b, _a[keys[2]] = c, _a);\n }; }; };\n case 4:\n return function (a) { return function (b) { return function (c) { return function (d) {\n var _a;\n return (_a = {},\n _a[keys[0]] = a,\n _a[keys[1]] = b,\n _a[keys[2]] = c,\n _a[keys[3]] = d,\n _a);\n }; }; }; };\n case 5:\n return function (a) { return function (b) { return function (c) { return function (d) { return function (e) {\n var _a;\n return (_a = {},\n _a[keys[0]] = a,\n _a[keys[1]] = b,\n _a[keys[2]] = c,\n _a[keys[3]] = d,\n _a[keys[4]] = e,\n _a);\n }; }; }; }; };\n default:\n return curried(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var r = {};\n for (var i = 0; i < len; i++) {\n r[keys[i]] = args[i];\n }\n return r;\n }, len - 1, []);\n }\n}\nexport function sequenceS(F) {\n return function (r) {\n var keys = Object.keys(r);\n var len = keys.length;\n var f = getRecordConstructor(keys);\n var fr = F.map(r[keys[0]], f);\n for (var i = 1; i < len; i++) {\n fr = F.ap(fr, r[keys[i]]);\n }\n return fr;\n };\n}\n","import { apFirst as apFirst_, apS as apS_, apSecond as apSecond_ } from './Apply';\nimport { bind as bind_, chainFirst as chainFirst_ } from './Chain';\nimport { fromEitherK as fromEitherK_ } from './FromEither';\nimport { dual, identity, pipe } from './function';\nimport { bindTo as bindTo_, flap as flap_, let as let__ } from './Functor';\nimport * as _ from './internal';\nimport * as NEA from './NonEmptyArray';\nimport * as RA from './ReadonlyArray';\nimport { separated } from './Separated';\nimport { filterE as filterE_, wiltDefault, witherDefault } from './Witherable';\nimport { guard as guard_ } from './Zero';\n// -------------------------------------------------------------------------------------\n// refinements\n// -------------------------------------------------------------------------------------\n/**\n * Test whether an array is empty\n *\n * @example\n * import { isEmpty } from 'fp-ts/Array'\n *\n * assert.strictEqual(isEmpty([]), true)\n * assert.strictEqual(isEmpty(['a']), false)\n *\n * @category refinements\n * @since 2.0.0\n */\nexport var isEmpty = function (as) { return as.length === 0; };\n/**\n * Test whether an array is non empty narrowing down the type to `NonEmptyArray`\n *\n * @example\n * import { isNonEmpty } from 'fp-ts/Array'\n *\n * assert.strictEqual(isNonEmpty([]), false)\n * assert.strictEqual(isNonEmpty(['a']), true)\n *\n * @category refinements\n * @since 2.0.0\n */\nexport var isNonEmpty = NEA.isNonEmpty;\n// -------------------------------------------------------------------------------------\n// constructors\n// -------------------------------------------------------------------------------------\n/**\n * Prepend an element to the front of a `Array`, creating a new `NonEmptyArray`.\n *\n * @example\n * import { prepend } from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(pipe([2, 3, 4], prepend(1)), [1, 2, 3, 4])\n *\n * @since 2.10.0\n */\nexport var prepend = NEA.prepend;\n/**\n * Less strict version of [`prepend`](#prepend).\n *\n * @example\n * import { prependW } from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(pipe([2, 3, 4], prependW(\"a\")), [\"a\", 2, 3, 4]);\n *\n * @since 2.11.0\n */\nexport var prependW = NEA.prependW;\n/**\n * Append an element to the end of a `Array`, creating a new `NonEmptyArray`.\n *\n * @example\n * import { append } from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(pipe([1, 2, 3], append(4)), [1, 2, 3, 4])\n *\n * @since 2.10.0\n */\nexport var append = NEA.append;\n/**\n * Less strict version of [`append`](#append).\n *\n * @example\n * import { appendW } from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(pipe([1, 2, 3], appendW(\"d\")), [1, 2, 3, \"d\"]);\n *\n * @since 2.11.0\n */\nexport var appendW = NEA.appendW;\n/**\n * Return a `Array` of length `n` with element `i` initialized with `f(i)`.\n *\n * **Note**. `n` is normalized to a non negative integer.\n *\n * @example\n * import { makeBy } from 'fp-ts/Array'\n *\n * const double = (i: number): number => i * 2\n * assert.deepStrictEqual(makeBy(5, double), [0, 2, 4, 6, 8])\n * assert.deepStrictEqual(makeBy(-3, double), [])\n * assert.deepStrictEqual(makeBy(4.32164, double), [0, 2, 4, 6])\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var makeBy = function (n, f) { return (n <= 0 ? [] : NEA.makeBy(f)(n)); };\n/**\n * Create a `Array` containing a value repeated the specified number of times.\n *\n * **Note**. `n` is normalized to a non negative integer.\n *\n * @example\n * import { replicate } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(replicate(3, 'a'), ['a', 'a', 'a'])\n * assert.deepStrictEqual(replicate(-3, 'a'), [])\n * assert.deepStrictEqual(replicate(2.985647, 'a'), ['a', 'a'])\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var replicate = function (n, a) { return makeBy(n, function () { return a; }); };\nexport function fromPredicate(predicate) {\n return function (a) { return (predicate(a) ? [a] : []); };\n}\n// -------------------------------------------------------------------------------------\n// conversions\n// -------------------------------------------------------------------------------------\n/**\n * Create an array from an `Option`. The resulting array will contain the content of the\n * `Option` if it is `Some` and it will be empty if the `Option` is `None`.\n *\n * @example\n * import { fromOption } from 'fp-ts/Array'\n * import { option } from \"fp-ts\";\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(pipe(option.some(\"a\"), fromOption),[\"a\"])\n * assert.deepStrictEqual(pipe(option.none, fromOption),[])\n *\n * @category conversions\n * @since 2.11.0\n */\nexport var fromOption = function (ma) { return (_.isNone(ma) ? [] : [ma.value]); };\n/**\n * Create an array from an `Either`. The resulting array will contain the content of the\n * `Either` if it is `Right` and it will be empty if the `Either` is `Left`.\n *\n * @example\n * import { fromEither } from 'fp-ts/Array'\n * import { either } from \"fp-ts\";\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(pipe(either.right(\"r\"), fromEither), [\"r\"]);\n * assert.deepStrictEqual(pipe(either.left(\"l\"), fromEither), []);\n *\n * @category conversions\n * @since 2.11.0\n */\nexport var fromEither = function (e) { return (_.isLeft(e) ? [] : [e.right]); };\n/**\n * Less strict version of [`match`](#match).\n *\n * The `W` suffix (short for **W**idening) means that the handler return types will be merged.\n *\n * @example\n * import { matchW } from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n *\n * const matcherW = matchW(\n * () => \"No elements\",\n * (as) => as.length\n * );\n * assert.deepStrictEqual(pipe([1, 2, 3, 4], matcherW), 4);\n * assert.deepStrictEqual(pipe([], matcherW), \"No elements\");\n *\n * @category pattern matching\n * @since 2.11.0\n */\nexport var matchW = function (onEmpty, onNonEmpty) {\n return function (as) {\n return isNonEmpty(as) ? onNonEmpty(as) : onEmpty();\n };\n};\n/**\n * Takes an array, if the array is empty it returns the result of `onEmpty`, otherwise\n * it passes the array to `onNonEmpty` and returns the result.\n *\n * @example\n * import { match } from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n *\n * const matcher = match(\n * () => \"No elements\",\n * (as) => `Found ${as.length} element(s)`\n * );\n * assert.deepStrictEqual(pipe([1, 2, 3, 4], matcher), \"Found 4 element(s)\");\n * assert.deepStrictEqual(pipe([], matcher), \"No elements\");\n *\n * @category pattern matching\n * @since 2.11.0\n */\nexport var match = matchW;\n/**\n * Less strict version of [`matchLeft`](#matchleft). It will work when `onEmpty` and\n * `onNonEmpty` have different return types.\n *\n * @example\n * import { matchLeftW } from 'fp-ts/Array'\n *\n * const f = matchLeftW(\n * () => 0,\n * (head: string, tail: string[]) => `Found \"${head}\" followed by ${tail.length} elements`\n * );\n * assert.strictEqual(f([\"a\", \"b\", \"c\"]), 'Found \"a\" followed by 2 elements');\n * assert.strictEqual(f([]), 0);\n *\n * @category pattern matching\n * @since 2.11.0\n */\nexport var matchLeftW = function (onEmpty, onNonEmpty) {\n return function (as) {\n return isNonEmpty(as) ? onNonEmpty(NEA.head(as), NEA.tail(as)) : onEmpty();\n };\n};\n/**\n * Takes an array, if the array is empty it returns the result of `onEmpty`, otherwise\n * it passes the array to `onNonEmpty` broken into its first element and remaining elements.\n *\n * @example\n * import { matchLeft } from 'fp-ts/Array'\n *\n * const len: (as: Array) => number = matchLeft(() => 0, (_, tail) => 1 + len(tail))\n * assert.strictEqual(len([1, 2, 3]), 3)\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var matchLeft = matchLeftW;\n/**\n * Alias of [`matchLeft`](#matchleft).\n *\n * @category pattern matching\n * @since 2.0.0\n */\nexport var foldLeft = matchLeft;\n/**\n * Less strict version of [`matchRight`](#matchright). It will work when `onEmpty` and\n * `onNonEmpty` have different return types.\n *\n * @example\n * import { matchRightW } from 'fp-ts/Array'\n *\n * const f = matchRightW(\n * () => 0,\n * (head: string[], tail: string) => `Found ${head.length} elements folllowed by \"${tail}\"`\n * );\n * assert.strictEqual(f([\"a\", \"b\", \"c\"]), 'Found 2 elements folllowed by \"c\"');\n * assert.strictEqual(f([]), 0);\n *\n * @category pattern matching\n * @since 2.11.0\n */\nexport var matchRightW = function (onEmpty, onNonEmpty) {\n return function (as) {\n return isNonEmpty(as) ? onNonEmpty(NEA.init(as), NEA.last(as)) : onEmpty();\n };\n};\n/**\n * Takes an array, if the array is empty it returns the result of `onEmpty`, otherwise\n * it passes the array to `onNonEmpty` broken into its initial elements and the last element.\n *\n * @example\n * import { matchRight } from 'fp-ts/Array'\n *\n * const len: (as: Array) => number = matchRight(\n * () => 0,\n * (head, _) => 1 + len(head)\n * );\n * assert.strictEqual(len([1, 2, 3]), 3);\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var matchRight = matchRightW;\n/**\n * Alias of [`matchRight`](#matchright).\n *\n * @category pattern matching\n * @since 2.0.0\n */\nexport var foldRight = matchRight;\n// -------------------------------------------------------------------------------------\n// combinators\n// -------------------------------------------------------------------------------------\n/**\n * Same as [`chain`](#chain), but passing also the index to the iterating function.\n *\n * @example\n * import { chainWithIndex, replicate } from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n *\n * const f = (index: number, x: string) => replicate(2, `${x}${index}`);\n * assert.deepStrictEqual(pipe([\"a\", \"b\", \"c\"], chainWithIndex(f)), [\"a0\", \"a0\", \"b1\", \"b1\", \"c2\", \"c2\"]);\n *\n * @category sequencing\n * @since 2.7.0\n */\nexport var chainWithIndex = function (f) {\n return function (as) {\n var out = [];\n for (var i = 0; i < as.length; i++) {\n out.push.apply(out, f(i, as[i]));\n }\n return out;\n };\n};\n/**\n * Same as `reduce` but it carries over the intermediate steps\n *\n * @example\n * import { scanLeft } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(scanLeft(10, (b, a: number) => b - a)([1, 2, 3]), [10, 9, 7, 4])\n *\n * @since 2.0.0\n */\nexport var scanLeft = function (b, f) {\n return function (as) {\n var len = as.length;\n var out = new Array(len + 1);\n out[0] = b;\n for (var i = 0; i < len; i++) {\n out[i + 1] = f(out[i], as[i]);\n }\n return out;\n };\n};\n/**\n * Fold an array from the right, keeping all intermediate results instead of only the final result\n *\n * @example\n * import { scanRight } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(scanRight(10, (a: number, b) => b - a)([1, 2, 3]), [4, 5, 7, 10])\n *\n * @since 2.0.0\n */\nexport var scanRight = function (b, f) {\n return function (as) {\n var len = as.length;\n var out = new Array(len + 1);\n out[len] = b;\n for (var i = len - 1; i >= 0; i--) {\n out[i] = f(as[i], out[i + 1]);\n }\n return out;\n };\n};\n/**\n * Calculate the number of elements in a `Array`.\n *\n * @example\n * import { size } from 'fp-ts/Array'\n *\n * assert.strictEqual(size([\"a\",\"b\",\"c\"]),3)\n *\n * @since 2.10.0\n */\nexport var size = function (as) { return as.length; };\n/**\n * Test whether an array contains a particular index\n *\n * @example\n * import { isOutOfBound } from 'fp-ts/Array'\n *\n * assert.strictEqual(isOutOfBound(1,[\"a\",\"b\",\"c\"]),false)\n * assert.strictEqual(isOutOfBound(-1,[\"a\",\"b\",\"c\"]),true)\n * assert.strictEqual(isOutOfBound(3,[\"a\",\"b\",\"c\"]),true)\n *\n * @since 2.0.0\n */\nexport var isOutOfBound = NEA.isOutOfBound;\n// TODO: remove non-curried overloading in v3\n/**\n * This function provides a safe way to read a value at a particular index from an array.\n * It returns a `none` if the index is out of bounds, and a `some` of the element if the\n * index is valid.\n *\n * @example\n * import { lookup } from 'fp-ts/Array'\n * import { some, none } from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(pipe([1, 2, 3], lookup(1)), some(2))\n * assert.deepStrictEqual(pipe([1, 2, 3], lookup(3)), none)\n *\n * @since 2.0.0\n */\nexport var lookup = RA.lookup;\n/**\n * Get the first element in an array, or `None` if the array is empty\n *\n * @example\n * import { head } from 'fp-ts/Array'\n * import { some, none } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(head([1, 2, 3]), some(1))\n * assert.deepStrictEqual(head([]), none)\n *\n * @since 2.0.0\n */\nexport var head = RA.head;\n/**\n * Get the last element in an array, or `None` if the array is empty\n *\n * @example\n * import { last } from 'fp-ts/Array'\n * import { some, none } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(last([1, 2, 3]), some(3))\n * assert.deepStrictEqual(last([]), none)\n *\n * @since 2.0.0\n */\nexport var last = RA.last;\n/**\n * Get all but the first element of an array, creating a new array, or `None` if the array is empty\n *\n * @example\n * import { tail } from 'fp-ts/Array'\n * import { some, none } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(tail([1, 2, 3]), some([2, 3]))\n * assert.deepStrictEqual(tail([]), none)\n *\n * @since 2.0.0\n */\nexport var tail = function (as) { return (isNonEmpty(as) ? _.some(NEA.tail(as)) : _.none); };\n/**\n * Get all but the last element of an array, creating a new array, or `None` if the array is empty\n *\n * @example\n * import { init } from 'fp-ts/Array'\n * import { some, none } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(init([1, 2, 3]), some([1, 2]))\n * assert.deepStrictEqual(init([]), none)\n *\n * @since 2.0.0\n */\nexport var init = function (as) { return (isNonEmpty(as) ? _.some(NEA.init(as)) : _.none); };\n/**\n * Keep only a max number of elements from the start of an `Array`, creating a new `Array`.\n *\n * **Note**. `n` is normalized to a non negative integer.\n *\n * @example\n * import { takeLeft } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(takeLeft(2)([1, 2, 3, 4, 5]), [1, 2]);\n * assert.deepStrictEqual(takeLeft(7)([1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]);\n * assert.deepStrictEqual(takeLeft(0)([1, 2, 3, 4, 5]), []);\n * assert.deepStrictEqual(takeLeft(-1)([1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]);\n *\n * @since 2.0.0\n */\nexport var takeLeft = function (n) {\n return function (as) {\n return isOutOfBound(n, as) ? copy(as) : as.slice(0, n);\n };\n};\n/**\n * Keep only a max number of elements from the end of an `Array`, creating a new `Array`.\n *\n * **Note**. `n` is normalized to a non negative integer.\n *\n * @example\n * import { takeRight } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(takeRight(2)([1, 2, 3, 4, 5]), [4, 5]);\n * assert.deepStrictEqual(takeRight(7)([1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]);\n * assert.deepStrictEqual(takeRight(0)([1, 2, 3, 4, 5]), []);\n * assert.deepStrictEqual(takeRight(-1)([1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]);\n *\n * @since 2.0.0\n */\nexport var takeRight = function (n) {\n return function (as) {\n return isOutOfBound(n, as) ? copy(as) : n === 0 ? [] : as.slice(-n);\n };\n};\nexport function takeLeftWhile(predicate) {\n return function (as) {\n var out = [];\n for (var _i = 0, as_1 = as; _i < as_1.length; _i++) {\n var a = as_1[_i];\n if (!predicate(a)) {\n break;\n }\n out.push(a);\n }\n return out;\n };\n}\nvar spanLeftIndex = function (as, predicate) {\n var l = as.length;\n var i = 0;\n for (; i < l; i++) {\n if (!predicate(as[i])) {\n break;\n }\n }\n return i;\n};\nexport function spanLeft(predicate) {\n return function (as) {\n var _a = splitAt(spanLeftIndex(as, predicate))(as), init = _a[0], rest = _a[1];\n return { init: init, rest: rest };\n };\n}\n/**\n * Creates a new `Array` which is a copy of the input dropping a max number of elements from the start.\n *\n * **Note**. `n` is normalized to a non negative integer.\n *\n * @example\n * import { dropLeft } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(dropLeft(2)([1, 2, 3]), [3]);\n * assert.deepStrictEqual(dropLeft(5)([1, 2, 3]), []);\n * assert.deepStrictEqual(dropLeft(0)([1, 2, 3]), [1, 2, 3]);\n * assert.deepStrictEqual(dropLeft(-2)([1, 2, 3]), [1, 2, 3]);\n *\n * @since 2.0.0\n */\nexport var dropLeft = function (n) {\n return function (as) {\n return n <= 0 || isEmpty(as) ? copy(as) : n >= as.length ? [] : as.slice(n, as.length);\n };\n};\n/**\n * Creates a new `Array` which is a copy of the input dropping a max number of elements from the end.\n *\n * **Note**. `n` is normalized to a non negative integer.\n *\n * @example\n * import { dropRight } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(dropRight(2)([1, 2, 3]), [1]);\n * assert.deepStrictEqual(dropRight(5)([1, 2, 3]), []);\n * assert.deepStrictEqual(dropRight(0)([1, 2, 3]), [1, 2, 3]);\n * assert.deepStrictEqual(dropRight(-2)([1, 2, 3]), [1, 2, 3]);\n *\n * @since 2.0.0\n */\nexport var dropRight = function (n) {\n return function (as) {\n return n <= 0 || isEmpty(as) ? copy(as) : n >= as.length ? [] : as.slice(0, as.length - n);\n };\n};\nexport function dropLeftWhile(predicate) {\n return function (as) { return as.slice(spanLeftIndex(as, predicate)); };\n}\n/**\n * `findIndex` returns an `Option` containing the first index for which a predicate holds.\n * It returns `None` if no element satisfies the predicate.\n * Similar to [`findFirst`](#findFirst) but returning the index instead of the element.\n *\n * @example\n * import { findIndex } from 'fp-ts/Array'\n * import { some, none } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(findIndex((n: number) => n === 2)([1, 2, 3]), some(1))\n * assert.deepStrictEqual(findIndex((n: number) => n === 2)([]), none)\n *\n * @since 2.0.0\n */\nexport var findIndex = RA.findIndex;\nexport function findFirst(predicate) {\n return RA.findFirst(predicate);\n}\n/**\n * Given a selector function which takes an element and returns an option,\n * this function applies the selector to each element of the array and\n * returns the first `Some` result. Otherwise it returns `None`.\n *\n * @example\n * import { findFirstMap } from 'fp-ts/Array'\n * import { some, none } from 'fp-ts/Option'\n *\n * interface Person {\n * readonly name: string;\n * readonly age: number;\n * }\n *\n * const persons: Array = [\n * { name: \"John\", age: 16 },\n * { name: \"Mary\", age: 45 },\n * { name: \"Joey\", age: 28 },\n * ];\n *\n * const nameOfPersonAbove18 = (p: Person) => (p.age <= 18 ? none : some(p.name));\n * const nameOfPersonAbove70 = (p: Person) => (p.age <= 70 ? none : some(p.name));\n * assert.deepStrictEqual(findFirstMap(nameOfPersonAbove18)(persons), some(\"Mary\"));\n * assert.deepStrictEqual(findFirstMap(nameOfPersonAbove70)(persons), none);\n *\n * @since 2.0.0\n */\nexport var findFirstMap = RA.findFirstMap;\nexport function findLast(predicate) {\n return RA.findLast(predicate);\n}\n/**\n * Given a selector function which takes an element and returns an option,\n * this function applies the selector to each element of the array starting from the\n * end and returns the last `Some` result. Otherwise it returns `None`.\n *\n * @example\n * import { findLastMap } from 'fp-ts/Array'\n * import { some, none } from 'fp-ts/Option'\n *\n * interface Person {\n * readonly name: string;\n * readonly age: number;\n * }\n *\n * const persons: Array = [\n * { name: \"John\", age: 16 },\n * { name: \"Mary\", age: 45 },\n * { name: \"Joey\", age: 28 },\n * ];\n *\n * const nameOfPersonAbove18 = (p: Person) => (p.age <= 18 ? none : some(p.name));\n * const nameOfPersonAbove70 = (p: Person) => (p.age <= 70 ? none : some(p.name));\n * assert.deepStrictEqual(findLastMap(nameOfPersonAbove18)(persons), some(\"Joey\"));\n * assert.deepStrictEqual(findLastMap(nameOfPersonAbove70)(persons), none);\n *\n * @since 2.0.0\n */\nexport var findLastMap = RA.findLastMap;\n/**\n * Returns the index of the last element of the list which matches the predicate.\n * It returns an `Option` containing the index or `None` if not found.\n *\n * @example\n * import { findLastIndex } from 'fp-ts/Array'\n * import { some, none } from 'fp-ts/Option'\n *\n * interface X {\n * readonly a: number\n * readonly b: number\n * }\n * const xs: Array = [{ a: 1, b: 0 }, { a: 1, b: 1 }]\n * assert.deepStrictEqual(findLastIndex((x: { readonly a: number }) => x.a === 1)(xs), some(1))\n * assert.deepStrictEqual(findLastIndex((x: { readonly a: number }) => x.a === 4)(xs), none)\n *\n * @since 2.0.0\n */\nexport var findLastIndex = RA.findLastIndex;\n/**\n * This function takes an array and makes a new array containing the same elements.\n *\n * @since 2.0.0\n */\nexport var copy = function (as) { return as.slice(); };\n/**\n * Insert an element at the specified index, creating a new array,\n * or returning `None` if the index is out of bounds.\n *\n * @example\n * import { insertAt } from 'fp-ts/Array'\n * import { some } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(insertAt(2, 5)([1, 2, 3, 4]), some([1, 2, 5, 3, 4]))\n *\n * @since 2.0.0\n */\nexport var insertAt = function (i, a) {\n return function (as) {\n return i < 0 || i > as.length ? _.none : _.some(unsafeInsertAt(i, a, as));\n };\n};\n/**\n * Change the element at the specified index, creating a new array,\n * or returning `None` if the index is out of bounds.\n *\n * @example\n * import { updateAt } from 'fp-ts/Array'\n * import { some, none } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(updateAt(1, 1)([1, 2, 3]), some([1, 1, 3]))\n * assert.deepStrictEqual(updateAt(1, 1)([]), none)\n *\n * @since 2.0.0\n */\nexport var updateAt = function (i, a) { return modifyAt(i, function () { return a; }); };\n/**\n * Delete the element at the specified index, creating a new array, or returning `None` if the index is out of bounds.\n *\n * @example\n * import { deleteAt } from 'fp-ts/Array'\n * import { some, none } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(deleteAt(0)([1, 2, 3]), some([2, 3]))\n * assert.deepStrictEqual(deleteAt(1)([]), none)\n *\n * @since 2.0.0\n */\nexport var deleteAt = function (i) {\n return function (as) {\n return isOutOfBound(i, as) ? _.none : _.some(unsafeDeleteAt(i, as));\n };\n};\n/**\n * Apply a function to the element at the specified index, creating a new array, or returning `None` if the index is out\n * of bounds.\n *\n * @example\n * import { modifyAt } from 'fp-ts/Array'\n * import { some, none } from 'fp-ts/Option'\n *\n * const double = (x: number): number => x * 2\n * assert.deepStrictEqual(modifyAt(1, double)([1, 2, 3]), some([1, 4, 3]))\n * assert.deepStrictEqual(modifyAt(1, double)([]), none)\n *\n * @since 2.0.0\n */\nexport var modifyAt = function (i, f) {\n return function (as) {\n return isOutOfBound(i, as) ? _.none : _.some(unsafeUpdateAt(i, f(as[i]), as));\n };\n};\n/**\n * Reverse an array, creating a new array\n *\n * @example\n * import { reverse } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(reverse([1, 2, 3]), [3, 2, 1])\n *\n * @since 2.0.0\n */\nexport var reverse = function (as) { return (isEmpty(as) ? [] : as.slice().reverse()); };\n/**\n * Takes an `Array` of `Either` and produces a new `Array` containing\n * the values of all the `Right` elements in the same order.\n *\n * @example\n * import { rights } from 'fp-ts/Array'\n * import { right, left } from 'fp-ts/Either'\n *\n * assert.deepStrictEqual(rights([right(1), left('foo'), right(2)]), [1, 2])\n *\n * @since 2.0.0\n */\nexport var rights = function (as) {\n var r = [];\n for (var i = 0; i < as.length; i++) {\n var a = as[i];\n if (a._tag === 'Right') {\n r.push(a.right);\n }\n }\n return r;\n};\n/**\n * Takes an `Array` of `Either` and produces a new `Array` containing\n * the values of all the `Left` elements in the same order.\n *\n * @example\n * import { lefts } from 'fp-ts/Array'\n * import { left, right } from 'fp-ts/Either'\n *\n * assert.deepStrictEqual(lefts([right(1), left('foo'), right(2)]), ['foo'])\n *\n * @since 2.0.0\n */\nexport var lefts = function (as) {\n var r = [];\n for (var i = 0; i < as.length; i++) {\n var a = as[i];\n if (a._tag === 'Left') {\n r.push(a.left);\n }\n }\n return r;\n};\n/**\n * Sort the elements of an array in increasing order, creating a new array\n *\n * @example\n * import { sort } from 'fp-ts/Array'\n * import * as N from 'fp-ts/number'\n *\n * assert.deepStrictEqual(sort(N.Ord)([3, 2, 1]), [1, 2, 3])\n *\n * @since 2.0.0\n */\nexport var sort = function (O) {\n return function (as) {\n return as.length <= 1 ? copy(as) : as.slice().sort(O.compare);\n };\n};\n/**\n * Apply a function to pairs of elements at the same index in two arrays, collecting the results in a new array. If one\n * input array is short, excess elements of the longer array are discarded.\n *\n * @example\n * import { zipWith } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(zipWith([1, 2, 3], ['a', 'b', 'c', 'd'], (n, s) => s + n), ['a1', 'b2', 'c3'])\n *\n * @since 2.0.0\n */\nexport var zipWith = function (fa, fb, f) {\n var fc = [];\n var len = Math.min(fa.length, fb.length);\n for (var i = 0; i < len; i++) {\n fc[i] = f(fa[i], fb[i]);\n }\n return fc;\n};\nexport function zip(as, bs) {\n if (bs === undefined) {\n return function (bs) { return zip(bs, as); };\n }\n return zipWith(as, bs, function (a, b) { return [a, b]; });\n}\n/**\n * The function is reverse of `zip`. Takes an array of pairs and return two corresponding arrays\n *\n * @example\n * import { unzip } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(unzip([[1, 'a'], [2, 'b'], [3, 'c']]), [[1, 2, 3], ['a', 'b', 'c']])\n *\n * @since 2.0.0\n */\nexport var unzip = function (as) {\n var fa = [];\n var fb = [];\n for (var i = 0; i < as.length; i++) {\n fa[i] = as[i][0];\n fb[i] = as[i][1];\n }\n return [fa, fb];\n};\n/**\n * Creates a new `Array`, prepending an element to every member of the input `Array`.\n *\n * @example\n * import { prependAll } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(prependAll(9)([1, 2, 3, 4]), [9, 1, 9, 2, 9, 3, 9, 4])\n *\n * @since 2.10.0\n */\nexport var prependAll = function (middle) {\n var f = NEA.prependAll(middle);\n return function (as) { return (isNonEmpty(as) ? f(as) : []); };\n};\n/**\n * Creates a new `Array` placing an element in between members of the input `Array`.\n *\n * @example\n * import { intersperse } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(intersperse(9)([1, 2, 3, 4]), [1, 9, 2, 9, 3, 9, 4])\n *\n * @since 2.9.0\n */\nexport var intersperse = function (middle) {\n var f = NEA.intersperse(middle);\n return function (as) { return (isNonEmpty(as) ? f(as) : copy(as)); };\n};\n/**\n * Creates a new `Array` rotating the input `Array` by `n` steps.\n *\n * @example\n * import { rotate } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(rotate(2)([1, 2, 3, 4, 5]), [4, 5, 1, 2, 3])\n *\n * @since 2.0.0\n */\nexport var rotate = function (n) {\n var f = NEA.rotate(n);\n return function (as) { return (isNonEmpty(as) ? f(as) : copy(as)); };\n};\n// TODO: remove non-curried overloading in v3\n/**\n * Test if a value is a member of an `Array`. Takes a `Eq` as a single\n * argument which returns the function to use to search for a value of type `A` in\n * an `Array`.\n *\n * @example\n * import { elem } from 'fp-ts/Array'\n * import * as N from 'fp-ts/number'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.strictEqual(pipe([1, 2, 3], elem(N.Eq)(2)), true)\n * assert.strictEqual(pipe([1, 2, 3], elem(N.Eq)(0)), false)\n *\n * @since 2.0.0\n */\nexport var elem = RA.elem;\n/**\n * Creates a new `Array` removing duplicate elements, keeping the first occurrence of an element,\n * based on a `Eq`.\n *\n * @example\n * import { uniq } from 'fp-ts/Array'\n * import * as N from 'fp-ts/number'\n *\n * assert.deepStrictEqual(uniq(N.Eq)([1, 2, 1]), [1, 2])\n *\n * @since 2.0.0\n */\nexport var uniq = function (E) {\n var f = NEA.uniq(E);\n return function (as) { return (isNonEmpty(as) ? f(as) : copy(as)); };\n};\n/**\n * Sort the elements of an array in increasing order, where elements are compared using first `ords[0]`, then `ords[1]`,\n * etc...\n *\n * @example\n * import { sortBy } from 'fp-ts/Array'\n * import { contramap } from 'fp-ts/Ord'\n * import * as S from 'fp-ts/string'\n * import * as N from 'fp-ts/number'\n * import { pipe } from 'fp-ts/function'\n *\n * interface Person {\n * readonly name: string\n * readonly age: number\n * }\n * const byName = pipe(S.Ord, contramap((p: Person) => p.name))\n * const byAge = pipe(N.Ord, contramap((p: Person) => p.age))\n *\n * const sortByNameByAge = sortBy([byName, byAge])\n *\n * const persons = [{ name: 'a', age: 1 }, { name: 'b', age: 3 }, { name: 'c', age: 2 }, { name: 'b', age: 2 }]\n * assert.deepStrictEqual(sortByNameByAge(persons), [\n * { name: 'a', age: 1 },\n * { name: 'b', age: 2 },\n * { name: 'b', age: 3 },\n * { name: 'c', age: 2 }\n * ])\n *\n * @since 2.0.0\n */\nexport var sortBy = function (ords) {\n var f = NEA.sortBy(ords);\n return function (as) { return (isNonEmpty(as) ? f(as) : copy(as)); };\n};\n/**\n * A useful recursion pattern for processing an array to produce a new array, often used for \"chopping\" up the input\n * array. Typically chop is called with some function that will consume an initial prefix of the array and produce a\n * value and the rest of the array.\n *\n * @example\n * import { Eq } from 'fp-ts/Eq'\n * import * as A from 'fp-ts/Array'\n * import * as N from 'fp-ts/number'\n * import { pipe } from 'fp-ts/function'\n *\n * const group = (S: Eq): ((as: Array) => Array>) => {\n * return A.chop(as => {\n * const { init, rest } = pipe(as, A.spanLeft((a: A) => S.equals(a, as[0])))\n * return [init, rest]\n * })\n * }\n * assert.deepStrictEqual(group(N.Eq)([1, 1, 2, 3, 3, 4]), [[1, 1], [2], [3, 3], [4]])\n *\n * @since 2.0.0\n */\nexport var chop = function (f) {\n var g = NEA.chop(f);\n return function (as) { return (isNonEmpty(as) ? g(as) : []); };\n};\n/**\n * Splits an `Array` into two pieces, the first piece has max `n` elements.\n *\n * @example\n * import { splitAt } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(splitAt(2)([1, 2, 3, 4, 5]), [[1, 2], [3, 4, 5]])\n *\n * @since 2.0.0\n */\nexport var splitAt = function (n) {\n return function (as) {\n return n >= 1 && isNonEmpty(as) ? NEA.splitAt(n)(as) : isEmpty(as) ? [copy(as), []] : [[], copy(as)];\n };\n};\n/**\n * Splits an array into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of\n * the array. Note that `chunksOf(n)([])` is `[]`, not `[[]]`. This is intentional, and is consistent with a recursive\n * definition of `chunksOf`; it satisfies the property that\n *\n * ```ts\n * chunksOf(n)(xs).concat(chunksOf(n)(ys)) == chunksOf(n)(xs.concat(ys)))\n * ```\n *\n * whenever `n` evenly divides the length of `xs`.\n *\n * @example\n * import { chunksOf } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(chunksOf(2)([1, 2, 3, 4, 5]), [[1, 2], [3, 4], [5]])\n *\n * @since 2.0.0\n */\nexport var chunksOf = function (n) {\n var f = NEA.chunksOf(n);\n return function (as) { return (isNonEmpty(as) ? f(as) : []); };\n};\n/**\n * @category lifting\n * @since 2.11.0\n */\nexport var fromOptionK = function (f) {\n return function () {\n var a = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n a[_i] = arguments[_i];\n }\n return fromOption(f.apply(void 0, a));\n };\n};\nexport function comprehension(input, f, g) {\n if (g === void 0) { g = function () { return true; }; }\n var go = function (scope, input) {\n return isNonEmpty(input)\n ? flatMap(NEA.head(input), function (a) { return go(pipe(scope, append(a)), NEA.tail(input)); })\n : g.apply(void 0, scope) ? [f.apply(void 0, scope)]\n : [];\n };\n return go([], input);\n}\n/**\n * @since 2.11.0\n */\nexport var concatW = function (second) {\n return function (first) {\n return isEmpty(first) ? copy(second) : isEmpty(second) ? copy(first) : first.concat(second);\n };\n};\n/**\n * @since 2.11.0\n */\nexport var concat = concatW;\nexport function union(E) {\n var unionE = NEA.union(E);\n return function (first, second) {\n if (second === undefined) {\n var unionE_1 = union(E);\n return function (second) { return unionE_1(second, first); };\n }\n return isNonEmpty(first) && isNonEmpty(second)\n ? unionE(second)(first)\n : isNonEmpty(first)\n ? copy(first)\n : copy(second);\n };\n}\nexport function intersection(E) {\n var elemE = elem(E);\n return function (xs, ys) {\n if (ys === undefined) {\n var intersectionE_1 = intersection(E);\n return function (ys) { return intersectionE_1(ys, xs); };\n }\n return xs.filter(function (a) { return elemE(a, ys); });\n };\n}\nexport function difference(E) {\n var elemE = elem(E);\n return function (xs, ys) {\n if (ys === undefined) {\n var differenceE_1 = difference(E);\n return function (ys) { return differenceE_1(ys, xs); };\n }\n return xs.filter(function (a) { return !elemE(a, ys); });\n };\n}\nvar _map = function (fa, f) { return pipe(fa, map(f)); };\n/* istanbul ignore next */\nvar _mapWithIndex = function (fa, f) { return pipe(fa, mapWithIndex(f)); };\nvar _ap = function (fab, fa) { return pipe(fab, ap(fa)); };\n/* istanbul ignore next */\nvar _filter = function (fa, predicate) { return pipe(fa, filter(predicate)); };\n/* istanbul ignore next */\nvar _filterMap = function (fa, f) { return pipe(fa, filterMap(f)); };\n/* istanbul ignore next */\nvar _partition = function (fa, predicate) {\n return pipe(fa, partition(predicate));\n};\n/* istanbul ignore next */\nvar _partitionMap = function (fa, f) { return pipe(fa, partitionMap(f)); };\n/* istanbul ignore next */\nvar _partitionWithIndex = function (fa, predicateWithIndex) { return pipe(fa, partitionWithIndex(predicateWithIndex)); };\n/* istanbul ignore next */\nvar _partitionMapWithIndex = function (fa, f) { return pipe(fa, partitionMapWithIndex(f)); };\n/* istanbul ignore next */\nvar _alt = function (fa, that) { return pipe(fa, alt(that)); };\nvar _reduce = function (fa, b, f) { return pipe(fa, reduce(b, f)); };\n/* istanbul ignore next */\nvar _foldMap = function (M) {\n var foldMapM = foldMap(M);\n return function (fa, f) { return pipe(fa, foldMapM(f)); };\n};\n/* istanbul ignore next */\nvar _reduceRight = function (fa, b, f) { return pipe(fa, reduceRight(b, f)); };\n/* istanbul ignore next */\nvar _reduceWithIndex = function (fa, b, f) {\n return pipe(fa, reduceWithIndex(b, f));\n};\n/* istanbul ignore next */\nvar _foldMapWithIndex = function (M) {\n var foldMapWithIndexM = foldMapWithIndex(M);\n return function (fa, f) { return pipe(fa, foldMapWithIndexM(f)); };\n};\n/* istanbul ignore next */\nvar _reduceRightWithIndex = function (fa, b, f) {\n return pipe(fa, reduceRightWithIndex(b, f));\n};\n/* istanbul ignore next */\nvar _filterMapWithIndex = function (fa, f) { return pipe(fa, filterMapWithIndex(f)); };\n/* istanbul ignore next */\nvar _filterWithIndex = function (fa, predicateWithIndex) { return pipe(fa, filterWithIndex(predicateWithIndex)); };\n/* istanbul ignore next */\nvar _extend = function (fa, f) { return pipe(fa, extend(f)); };\n/* istanbul ignore next */\nvar _traverse = function (F) {\n var traverseF = traverse(F);\n return function (ta, f) { return pipe(ta, traverseF(f)); };\n};\n/* istanbul ignore next */\nvar _traverseWithIndex = function (F) {\n var traverseWithIndexF = traverseWithIndex(F);\n return function (ta, f) { return pipe(ta, traverseWithIndexF(f)); };\n};\nvar _chainRecDepthFirst = RA._chainRecDepthFirst;\nvar _chainRecBreadthFirst = RA._chainRecBreadthFirst;\n/**\n * Given an element of the base type, `of` builds an `Array` containing just that\n * element of the base type (this is useful for building a `Monad`).\n *\n * @example\n * import { of } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(of(\"a\"), [\"a\"]);\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var of = NEA.of;\n/**\n * Makes an empty `Array`, useful for building a [`Monoid`](#Monoid)\n *\n * @since 2.7.0\n */\nexport var zero = function () { return []; };\n/**\n * `map` can be used to turn functions `(a: A) => B` into functions `(fa: Array) => Array`.\n * In practice it applies the base function to each element of the array and collects the\n * results in a new array.\n *\n * @example\n * import { map } from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n *\n * const f = (n: number) => n * 2;\n * assert.deepStrictEqual(pipe([1, 2, 3], map(f)), [2, 4, 6]);\n *\n * @category mapping\n * @since 2.0.0\n */\nexport var map = function (f) { return function (fa) { return fa.map(function (a) { return f(a); }); }; };\n/**\n * @example\n * import { ap, map, of } from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n *\n * // a curried function with 3 input parameteres\n * const f = (s1: string) => (n: number) => (s2: string) => s1 + n + s2;\n *\n * // let's use `ap` to iterate `f` over an array for each input parameter\n * assert.deepStrictEqual(pipe([\"a\", \"b\"], map(f), ap([1, 2]), ap([\"😀\", \"😫\", \"😎\"])), [\n * \"a1😀\", \"a1😫\", \"a1😎\",\n * \"a2😀\", \"a2😫\", \"a2😎\",\n * \"b1😀\", \"b1😫\", \"b1😎\",\n * \"b2😀\", \"b2😫\", \"b2😎\",\n * ]);\n *\n * // given Array implements the Applicative interface with the `of` method,\n * // we can write exactly the same thing in a more symmetric way\n * // using `of` on `f` and `ap` on each array in input\n * assert.deepStrictEqual(\n * pipe(of(f), ap([\"a\", \"b\"]), ap([1, 2]), ap([\"😀\", \"😫\", \"😎\"])),\n * pipe([\"a\", \"b\"], map(f), ap([1, 2]), ap([\"😀\", \"😫\", \"😎\"]))\n * );\n *\n * @since 2.0.0\n */\nexport var ap = function (fa) {\n return flatMap(function (f) { return pipe(fa, map(f)); });\n};\n/**\n * Composes computations in sequence, using the return value of one computation to\n * determine the next computation.\n *\n * In other words it takes a function `f` that produces an array from a single element of\n * the base type `A` and returns a new function which applies `f` to each element of the\n * input array (like [`map`](#map)) and, instead of returning an array of arrays, concatenates the\n * results into a single array (like [`flatten`](#flatten)).\n *\n * @example\n * import { flatMap, map, replicate } from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n *\n * const f = (n: number) => replicate(n, `${n}`);\n * assert.deepStrictEqual(pipe([1, 2, 3], map(f)), [[\"1\"], [\"2\", \"2\"], [\"3\", \"3\", \"3\"]]);\n * assert.deepStrictEqual(pipe([1, 2, 3], flatMap(f)), [\"1\", \"2\", \"2\", \"3\", \"3\", \"3\"]);\n *\n * @category sequencing\n * @since 2.14.0\n */\nexport var flatMap = /*#__PURE__*/ dual(2, function (ma, f) {\n return pipe(ma, chainWithIndex(function (i, a) { return f(a, i); }));\n});\n/**\n * Takes an array of arrays of `A` and flattens them into an array of `A`\n * by concatenating the elements of each array in order.\n *\n * @example\n * import { flatten } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(flatten([[\"a\"], [\"b\", \"c\"], [\"d\", \"e\", \"f\"]]), [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"]);\n *\n * @category sequencing\n * @since 2.5.0\n */\nexport var flatten = /*#__PURE__*/ flatMap(identity);\n/**\n * Same as [`map`](#map), but the iterating function takes both the index and the value\n * of the element.\n *\n * @example\n * import { mapWithIndex } from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n *\n * const f = (i: number, s: string) => `${s} - ${i}`;\n * assert.deepStrictEqual(pipe([\"a\", \"b\", \"c\"], mapWithIndex(f)), [\"a - 0\", \"b - 1\", \"c - 2\"]);\n *\n * @category mapping\n * @since 2.0.0\n */\nexport var mapWithIndex = function (f) { return function (fa) {\n return fa.map(function (a, i) { return f(i, a); });\n}; };\n/**\n * Maps an array with an iterating function that takes the index and the value of\n * each element and returns an `Option`. It keeps only the `Some` values discarding\n * the `None`s.\n *\n * Same as [`filterMap`](#filterMap), but with an iterating function which takes also\n * the index as input.\n *\n * @example\n * import { filterMapWithIndex } from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n * import { option } from \"fp-ts\";\n *\n * const f = (i: number, s: string) => (i % 2 === 1 ? option.some(s.toUpperCase()) : option.none);\n * assert.deepStrictEqual(pipe([\"a\", \"no\", \"neither\", \"b\"], filterMapWithIndex(f)), [\"NO\", \"B\"]);\n *\n * @category filtering\n * @since 2.0.0\n */\nexport var filterMapWithIndex = function (f) {\n return function (fa) {\n var out = [];\n for (var i = 0; i < fa.length; i++) {\n var optionB = f(i, fa[i]);\n if (_.isSome(optionB)) {\n out.push(optionB.value);\n }\n }\n return out;\n };\n};\n/**\n * Maps an array with an iterating function that returns an `Option`\n * and it keeps only the `Some` values discarding the `None`s.\n *\n * @example\n * import { filterMap } from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n * import { option } from \"fp-ts\";\n *\n * const f = (s: string) => s.length === 1 ? option.some(s.toUpperCase()) : option.none;\n * assert.deepStrictEqual(pipe([\"a\", \"no\", \"neither\", \"b\"], filterMap(f)), [\"A\", \"B\"]);\n *\n * @category filtering\n * @since 2.0.0\n */\nexport var filterMap = function (f) {\n return filterMapWithIndex(function (_, a) { return f(a); });\n};\n/**\n * Compact an array of `Option`s discarding the `None` values and\n * keeping the `Some` values. It returns a new array containing the values of\n * the `Some` options.\n *\n * @example\n * import { compact } from 'fp-ts/Array'\n * import { option } from \"fp-ts\";\n *\n * assert.deepStrictEqual(compact([option.some(\"a\"), option.none, option.some(\"b\")]), [\"a\", \"b\"]);\n *\n * @category filtering\n * @since 2.0.0\n */\nexport var compact = /*#__PURE__*/ filterMap(identity);\n/**\n * Separate an array of `Either`s into `Left`s and `Right`s, creating two new arrays:\n * one containing all the left values and one containing all the right values.\n *\n * @example\n * import { separate } from 'fp-ts/Array'\n * import { either } from \"fp-ts\";\n *\n * assert.deepStrictEqual(separate([either.right(\"r1\"), either.left(\"l1\"), either.right(\"r2\")]), {\n * left: [\"l1\"],\n * right: [\"r1\", \"r2\"],\n * });\n *\n * @category filtering\n * @since 2.0.0\n */\nexport var separate = function (fa) {\n var left = [];\n var right = [];\n for (var _i = 0, fa_1 = fa; _i < fa_1.length; _i++) {\n var e = fa_1[_i];\n if (e._tag === 'Left') {\n left.push(e.left);\n }\n else {\n right.push(e.right);\n }\n }\n return separated(left, right);\n};\n/**\n * Given an iterating function that is a `Predicate` or a `Refinement`,\n * `filter` creates a new `Array` containing the elements of the original\n * `Array` for which the iterating function is `true`.\n *\n * @example\n * import { filter } from 'fp-ts/Array'\n * import { isString } from \"fp-ts/string\";\n *\n * assert.deepStrictEqual(filter(isString)([\"a\", 1, {}, \"b\", 5]), [\"a\", \"b\"]);\n * assert.deepStrictEqual(filter((x:number) => x > 0)([-3, 1, -2, 5]), [1, 5]);\n *\n * @category filtering\n * @since 2.0.0\n */\nexport var filter = function (predicate) {\n return function (as) {\n return as.filter(predicate);\n };\n};\n/**\n * Given an iterating function that is a `Predicate` or a `Refinement`,\n * `partition` creates two new `Array`s: `right` containing the elements of the original\n * `Array` for which the iterating function is `true`, `left` containing the elements\n * for which it is false.\n *\n * @example\n * import { partition } from 'fp-ts/Array'\n * import { isString } from \"fp-ts/string\";\n *\n * assert.deepStrictEqual(partition(isString)([\"a\", 1, {}, \"b\", 5]), { left: [1, {}, 5], right: [\"a\", \"b\"] });\n * assert.deepStrictEqual(partition((x: number) => x > 0)([-3, 1, -2, 5]), { left: [-3, -2], right: [1, 5] });\n *\n * @category filtering\n * @since 2.0.0\n */\nexport var partition = function (predicate) {\n return partitionWithIndex(function (_, a) { return predicate(a); });\n};\n/**\n * Same as [`partition`](#partition), but passing also the index to the iterating function.\n *\n * @example\n * import { partitionWithIndex } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(partitionWithIndex((index, x: number) => index < 3 && x > 0)([-2, 5, 6, 7]), {\n * left: [-2, 7],\n * right: [5, 6],\n * });\n *\n * @category filtering\n * @since 2.0.0\n */\nexport var partitionWithIndex = function (predicateWithIndex) {\n return function (as) {\n var left = [];\n var right = [];\n for (var i = 0; i < as.length; i++) {\n var b = as[i];\n if (predicateWithIndex(i, b)) {\n right.push(b);\n }\n else {\n left.push(b);\n }\n }\n return separated(left, right);\n };\n};\n/**\n * Given an iterating function that returns an `Either`,\n * `partitionMap` applies the iterating function to each element and it creates two `Array`s:\n * `right` containing the values of `Right` results, `left` containing the values of `Left` results.\n *\n * @example\n * import { partitionMap } from 'fp-ts/Array'\n * import { Either, left, right } from \"fp-ts/Either\";\n *\n * const upperIfString = (x: B): Either =>\n * typeof x === \"string\" ? right(x.toUpperCase()) : left(x);\n * assert.deepStrictEqual(partitionMap(upperIfString)([-2, \"hello\", 6, 7, \"world\"]), {\n * left: [-2, 6, 7],\n * right: [ 'HELLO', 'WORLD' ],\n * });\n *\n * @category filtering\n * @since 2.0.0\n */\nexport var partitionMap = function (f) { return partitionMapWithIndex(function (_, a) { return f(a); }); };\n/**\n * Same as [`partitionMap`](#partitionMap), but passing also the index to the iterating function.\n *\n * @example\n * import { partitionMapWithIndex } from 'fp-ts/Array'\n * import { Either, left, right } from \"fp-ts/Either\";\n *\n * const upperIfStringBefore3 = (index: number, x: B): Either =>\n * index < 3 && typeof x === \"string\" ? right(x.toUpperCase()) : left(x);\n * assert.deepStrictEqual(partitionMapWithIndex(upperIfStringBefore3)([-2, \"hello\", 6, 7, \"world\"]), {\n * left: [-2, 6, 7, \"world\"],\n * right: [\"HELLO\"],\n * });\n *\n * @category filtering\n * @since 2.0.0\n */\nexport var partitionMapWithIndex = function (f) {\n return function (fa) {\n var left = [];\n var right = [];\n for (var i = 0; i < fa.length; i++) {\n var e = f(i, fa[i]);\n if (e._tag === 'Left') {\n left.push(e.left);\n }\n else {\n right.push(e.right);\n }\n }\n return separated(left, right);\n };\n};\n/**\n * Less strict version of [`alt`](#alt).\n *\n * The `W` suffix (short for **W**idening) means that the return types will be merged.\n *\n * @example\n * import * as A from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * A.altW(() => ['a', 'b'])\n * ),\n * [1, 2, 3, 'a', 'b']\n * )\n *\n * @category error handling\n * @since 2.9.0\n */\nexport var altW = function (that) {\n return function (fa) {\n return fa.concat(that());\n };\n};\n/**\n * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to\n * types of kind `* -> *`.\n *\n * In case of `Array` concatenates the inputs into a single array.\n *\n * @example\n * import * as A from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * A.alt(() => [4, 5])\n * ),\n * [1, 2, 3, 4, 5]\n * )\n *\n * @category error handling\n * @since 2.0.0\n */\nexport var alt = altW;\n/**\n * Same as [`filter`](#filter), but passing also the index to the iterating function.\n *\n * @example\n * import { filterWithIndex } from 'fp-ts/Array';\n *\n * const f = (index: number, x: number) => x > 0 && index <= 2;\n * assert.deepStrictEqual(filterWithIndex(f)([-3, 1, -2, 5]), [1]);\n *\n * @category filtering\n * @since 2.0.0\n */\nexport var filterWithIndex = function (predicateWithIndex) {\n return function (as) {\n return as.filter(function (b, i) { return predicateWithIndex(i, b); });\n };\n};\n/**\n * Given an iterating function that takes `Array` as input, `extend` returns\n * an array containing the results of the iterating function applied to the whole input\n * `Array`, then to the input `Array` without the first element, then to the input\n * `Array` without the first two elements, etc.\n *\n * @example\n * import { extend } from 'fp-ts/Array'\n *\n * const f = (a: string[]) => a.join(\",\");\n * assert.deepStrictEqual(extend(f)([\"a\", \"b\", \"c\"]), [\"a,b,c\", \"b,c\", \"c\"]);\n *\n * @since 2.0.0\n */\nexport var extend = function (f) { return function (wa) {\n return wa.map(function (_, i) { return f(wa.slice(i)); });\n}; };\n/**\n * `duplicate` returns an array containing the whole input `Array`,\n * then to the input `Array` dropping the first element, then to the input\n * `Array` dropping the first two elements, etc.\n *\n * @example\n * import { duplicate } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(duplicate([\"a\", \"b\", \"c\"]), [[\"a\", \"b\", \"c\"], [\"b\", \"c\"], [\"c\"]]);\n *\n * @since 2.0.0\n */\nexport var duplicate = /*#__PURE__*/ extend(identity);\n/**\n * Map and fold an `Array`.\n * Map the `Array` passing each value to the iterating function.\n * Then fold the results using the provided `Monoid`.\n *\n * @example\n * import { foldMap } from 'fp-ts/Array'\n *\n * const monoid = { concat: (a: string, b: string) => a + b, empty: \"\" };\n * const f = (s: string) => s.toUpperCase()\n * assert.deepStrictEqual(foldMap(monoid)(f)([\"a\", \"b\", \"c\"]), \"ABC\");\n *\n * @category folding\n * @since 2.0.0\n */\nexport var foldMap = RA.foldMap;\n/**\n * Same as [`foldMap`](#foldMap) but passing also the index to the iterating function.\n *\n * @example\n * import { foldMapWithIndex } from 'fp-ts/Array'\n *\n * const monoid = { concat: (a: string, b: string) => a + b, empty: \"\" };\n * const f = (index:number, s: string) => `${s.toUpperCase()}(${index})`\n * assert.deepStrictEqual(foldMapWithIndex(monoid)(f)([\"a\", \"b\", \"c\"]), \"A(0)B(1)C(2)\");\n *\n * @category folding\n * @since 2.0.0\n */\nexport var foldMapWithIndex = RA.foldMapWithIndex;\n/**\n * Reduces an `Array`.\n *\n * `reduce` executes the supplied iterating function on each element of the array,\n * in order, passing in the element and the return value from the calculation on the preceding element.\n *\n * The first time that the iterating function is called there is no \"return value of the\n * previous calculation\", the initial value is used in its place.\n *\n * @example\n * import { reduce } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(reduce(5, (acc: number, cur: number) => acc * cur)([2, 3]), 5 * 2 * 3);\n *\n * @category folding\n * @since 2.0.0\n */\nexport var reduce = RA.reduce;\n/**\n * Same as [`reduce`](#reduce) but passing also the index to the iterating function.\n *\n * @example\n * import { reduceWithIndex } from 'fp-ts/Array'\n *\n * const f = (index: number, acc: string, cur: unknown) =>\n * acc + (typeof cur === \"string\" ? cur.toUpperCase() + index : \"\");\n * assert.deepStrictEqual(reduceWithIndex(\"\", f)([2, \"a\", \"b\", null]), \"A1B2\");\n *\n * @category folding\n * @since 2.0.0\n */\nexport var reduceWithIndex = RA.reduceWithIndex;\n/**\n * Same as [`reduce`](#reduce) but applied from the end to the start.\n *\n * *Note*: the iterating function in this case takes the accumulator as the last argument.\n *\n * @example\n * import { reduceRight } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(reduceRight(\"\", (cur: string, acc: string) => acc + cur)([\"a\", \"b\", \"c\"]), \"cba\");\n *\n * @category folding\n * @since 2.0.0\n */\nexport var reduceRight = RA.reduceRight;\n/**\n * Same as [`reduceRight`](#reduceRight) but passing also the index to the iterating function.\n *\n * @example\n * import { reduceRightWithIndex } from 'fp-ts/Array'\n *\n * const f = (index: number, cur: unknown, acc: string) =>\n * acc + (typeof cur === \"string\" ? cur.toUpperCase() + index : \"\");\n * assert.deepStrictEqual(reduceRightWithIndex(\"\", f)([2, \"a\", \"b\", null]), \"B2A1\");\n *\n * @category folding\n * @since 2.0.0\n */\nexport var reduceRightWithIndex = RA.reduceRightWithIndex;\n/**\n * Given an iterating function that returns a `HKT` (higher kinded type), `traverse`\n * applies the iterating function to each element of the `Array` and then [`sequence`](#sequence)-s\n * the results using the provided `Applicative`.\n *\n * E.g. suppose you have an `Array` and you want to format each element with a function\n * that returns a result or an error as `f = (a: A) => Either`, using `traverse`\n * you can apply `f` to all elements and directly obtain as a result an `Either>`\n * i.e. an `Array` if all the results are `B`, or an `Error` if some of the results\n * are `Error`s.\n *\n * @example\n * import { traverse } from 'fp-ts/Array'\n * import { Applicative, left, right } from \"fp-ts/Either\";\n *\n * const f = (x: unknown) =>\n * typeof x === \"string\" ? right(x.toUpperCase()) : left(new Error(\"not a string\"));\n * assert.deepStrictEqual(traverse(Applicative)(f)([\"a\", \"b\"]), right([\"A\", \"B\"]));\n * assert.deepStrictEqual(traverse(Applicative)(f)([\"a\", 5]), left(new Error(\"not a string\")));\n *\n * @category traversing\n * @since 2.6.3\n */\nexport var traverse = function (F) {\n var traverseWithIndexF = traverseWithIndex(F);\n return function (f) { return traverseWithIndexF(function (_, a) { return f(a); }); };\n};\n/**\n * `sequence` takes an `Array` where elements are `HKT` (higher kinded type) and,\n * using an applicative of that `HKT`, returns an `HKT` of `Array`.\n * E.g. it can turn an `Array>` into an `Either>`.\n *\n * `sequence` requires an `Applicative` of the `HKT` you are targeting, e.g. to turn an\n * `Array>` into an `Either>`, it needs an\n * `Applicative` for `Either`, to to turn an `Array>` into an `Option>`,\n * it needs an `Applicative` for `Option`.\n *\n * @example\n * import { sequence } from 'fp-ts/Array'\n * import { Applicative, left, right } from \"fp-ts/Either\";\n *\n * assert.deepStrictEqual(sequence(Applicative)([right(\"a\"), right(\"b\")]), right([\"a\", \"b\"]));\n * assert.deepStrictEqual(\n * sequence(Applicative)([right(\"a\"), left(new Error(\"not a string\"))]),\n * left(new Error(\"not a string\"))\n * );\n *\n * @category traversing\n * @since 2.6.3\n */\nexport var sequence = function (F) {\n return function (ta) {\n return _reduce(ta, F.of(zero()), function (fas, fa) {\n return F.ap(F.map(fas, function (as) { return function (a) { return pipe(as, append(a)); }; }), fa);\n });\n };\n};\n/**\n * Same as [`traverse`](#traverse) but passing also the index to the iterating function.\n *\n * @example\n * import { traverseWithIndex } from 'fp-ts/Array'\n * import { Applicative, left, right } from \"fp-ts/Either\";\n *\n * const f = (index:number, x:unknown) =>\n * typeof x === \"string\" ? right(x.toUpperCase() + index) : left(new Error(\"not a string\"));\n * assert.deepStrictEqual(traverseWithIndex(Applicative)(f)([\"a\", \"b\"]), right([\"A0\", \"B1\"]));\n * assert.deepStrictEqual(traverseWithIndex(Applicative)(f)([\"a\", 5]), left(new Error(\"not a string\")));\n *\n * @category sequencing\n * @since 2.6.3\n */\nexport var traverseWithIndex = function (F) {\n return function (f) {\n return reduceWithIndex(F.of(zero()), function (i, fbs, a) {\n return F.ap(F.map(fbs, function (bs) { return function (b) { return pipe(bs, append(b)); }; }), f(i, a));\n });\n };\n};\n/**\n * @category filtering\n * @since 2.6.5\n */\nexport var wither = function (F) {\n var _witherF = _wither(F);\n return function (f) { return function (fa) { return _witherF(fa, f); }; };\n};\n/**\n * @category filtering\n * @since 2.6.5\n */\nexport var wilt = function (F) {\n var _wiltF = _wilt(F);\n return function (f) { return function (fa) { return _wiltF(fa, f); }; };\n};\n/**\n * `unfold` takes a function `f` which returns an `Option` of a tuple containing an outcome\n * value and an input for the following iteration.\n * `unfold` applies `f` to the initial value `b` and then recursively to the second\n * element of the tuple contained in the returned `option` of the previous\n * calculation until `f` returns `Option.none`.\n *\n * @example\n * import { unfold } from 'fp-ts/Array'\n * import { option } from 'fp-ts'\n *\n * const f = (n: number) => {\n * if (n <= 0) return option.none;\n * const returnValue = n * 2;\n * const inputForNextRound = n - 1;\n * return option.some([returnValue, inputForNextRound] as const);\n * };\n * assert.deepStrictEqual(unfold(5, f), [10, 8, 6, 4, 2]);\n *\n * @since 2.6.6\n */\nexport var unfold = function (b, f) {\n var out = [];\n var bb = b;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n var mt = f(bb);\n if (_.isSome(mt)) {\n var _a = mt.value, a = _a[0], b_1 = _a[1];\n out.push(a);\n bb = b_1;\n }\n else {\n break;\n }\n }\n return out;\n};\n/**\n * @category type lambdas\n * @since 2.0.0\n */\nexport var URI = 'Array';\n/**\n * `getShow` makes a `Show` for an `Array` from a `Show` for\n * an `A`.\n *\n * @example\n * import { getShow } from 'fp-ts/Array'\n *\n * const numShow = { show: (n: number) => (n >= 0 ? `${n}` : `(${-n})`) };\n * assert.deepStrictEqual(getShow(numShow).show([-2, -1, 0, 1]), \"[(2), (1), 0, 1]\");\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getShow = RA.getShow;\n/**\n * Get a `Semigroup` based on the concatenation of `Array`s.\n * See also [`getMonoid`](#getMonoid).\n *\n * @example\n * import { getSemigroup } from 'fp-ts/Array'\n *\n * const S = getSemigroup();\n * assert.deepStrictEqual(S.concat([1, 2], [2, 3]), [1, 2, 2, 3]);\n *\n * @category instances\n * @since 2.10.0\n */\nexport var getSemigroup = function () { return ({\n concat: function (first, second) { return first.concat(second); }\n}); };\n/**\n * Returns a `Monoid` for `Array` based on the concatenation of `Array`s.\n *\n * @example\n * import { getMonoid } from 'fp-ts/Array'\n *\n * const M = getMonoid()\n * assert.deepStrictEqual(M.concat([1, 2], [3, 4]), [1, 2, 3, 4])\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getMonoid = function () { return ({\n concat: getSemigroup().concat,\n empty: []\n}); };\n/**\n * Derives an `Eq` over the `Array` of a given element type from the `Eq` of that type. The derived `Eq` defines two\n * arrays as equal if all elements of both arrays are compared equal pairwise with the given `E`. In case of arrays of\n * different lengths, the result is non equality.\n *\n * @example\n * import * as S from 'fp-ts/string'\n * import { getEq } from 'fp-ts/Array'\n *\n * const E = getEq(S.Eq)\n * assert.strictEqual(E.equals(['a', 'b'], ['a', 'b']), true)\n * assert.strictEqual(E.equals(['a'], []), false)\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getEq = RA.getEq;\n/**\n * Derives an `Ord` over the `Array` of a given element type from the `Ord` of that type. The ordering between two such\n * arrays is equal to: the first non equal comparison of each arrays elements taken pairwise in increasing order, in\n * case of equality over all the pairwise elements; the longest array is considered the greatest, if both arrays have\n * the same length, the result is equality.\n *\n * @example\n * import { getOrd } from 'fp-ts/Array'\n * import * as S from 'fp-ts/string'\n *\n * const O = getOrd(S.Ord)\n * assert.strictEqual(O.compare(['b'], ['a']), 1)\n * assert.strictEqual(O.compare(['a'], ['a']), 0)\n * assert.strictEqual(O.compare(['a'], ['b']), -1)\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getOrd = RA.getOrd;\n/**\n * Get a `Semigroup` based on the union of the elements of `Array`s.\n * Elements which equal according to the provided `Eq` are included\n * only once in the result.\n * See also [`getUnionMonoid`](#getUnionMonoid).\n *\n * @example\n * import { getUnionSemigroup } from 'fp-ts/Array';\n * import { Eq } from 'fp-ts/number';\n *\n * const S = getUnionSemigroup(Eq);\n * assert.deepStrictEqual(S.concat([1, 2], [2, 3]), [1, 2, 3]);\n *\n * @category instances\n * @since 2.11.0\n */\nexport var getUnionSemigroup = function (E) {\n var unionE = union(E);\n return {\n concat: function (first, second) { return unionE(second)(first); }\n };\n};\n/**\n * Get a `Monoid` based on the union of the elements of `Array`s.\n * Elements which equal according to the provided `Eq` are included\n * only once in the result.\n *\n * @example\n * import { getUnionMonoid } from 'fp-ts/Array'\n * import { Eq } from 'fp-ts/number';\n *\n * const M = getUnionMonoid(Eq);\n * assert.deepStrictEqual(M.concat([1, 2], [2, 3]), [1, 2, 3]);\n * assert.deepStrictEqual(M.empty,[]);\n *\n * @category instances\n * @since 2.11.0\n */\nexport var getUnionMonoid = function (E) { return ({\n concat: getUnionSemigroup(E).concat,\n empty: []\n}); };\n/**\n * Get a `Semigroup` based on the intersection of the elements of `Array`s.\n * Only elements present in the two arrays which are equal according to the\n * provided `Eq` are included in the result.\n *\n * @example\n * import { getIntersectionSemigroup } from 'fp-ts/Array'\n * import { Eq } from 'fp-ts/number';\n *\n * const S = getIntersectionSemigroup(Eq);\n * assert.deepStrictEqual(S.concat([1, 2], [2, 3]), [2]);\n *\n * @category instances\n * @since 2.11.0\n */\nexport var getIntersectionSemigroup = function (E) {\n var intersectionE = intersection(E);\n return {\n concat: function (first, second) { return intersectionE(second)(first); }\n };\n};\n/**\n * Get a `Magma` for `Array` where the `concat` function is the differnce between\n * the first and the second array, i.e. the result contains all the elements of the\n * first array for which their is no equal element in the second array according\n * to the `Eq` provided.\n *\n *\n * @example\n * import { getDifferenceMagma } from 'fp-ts/Array'\n * import { Eq } from 'fp-ts/number';\n *\n * const S = getDifferenceMagma(Eq);\n * assert.deepStrictEqual(S.concat([1, 2], [2, 3]), [1]);\n *\n * @category instances\n * @since 2.11.0\n */\nexport var getDifferenceMagma = function (E) {\n var differenceE = difference(E);\n return {\n concat: function (first, second) { return differenceE(second)(first); }\n };\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Functor = {\n URI: URI,\n map: _map\n};\n/**\n * Given an input an `Array` of functions, `flap` returns an `Array` containing\n * the results of applying each function to the given input.\n *\n * @example\n * import { flap } from 'fp-ts/Array'\n *\n * const funs = [\n * (n: number) => `Double: ${n * 2}`,\n * (n: number) => `Triple: ${n * 3}`,\n * (n: number) => `Square: ${n * n}`,\n * ];\n * assert.deepStrictEqual(flap(4)(funs), ['Double: 8', 'Triple: 12', 'Square: 16']);\n *\n * @category mapping\n * @since 2.10.0\n */\nexport var flap = /*#__PURE__*/ flap_(Functor);\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Pointed = {\n URI: URI,\n of: of\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var FunctorWithIndex = {\n URI: URI,\n map: _map,\n mapWithIndex: _mapWithIndex\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Apply = {\n URI: URI,\n map: _map,\n ap: _ap\n};\n/**\n * Combine two effectful actions, keeping only the result of the first.\n *\n * @since 2.5.0\n */\nexport var apFirst = /*#__PURE__*/ apFirst_(Apply);\n/**\n * Combine two effectful actions, keeping only the result of the second.\n *\n * @since 2.5.0\n */\nexport var apSecond = /*#__PURE__*/ apSecond_(Apply);\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Applicative = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Chain = {\n URI: URI,\n map: _map,\n ap: _ap,\n chain: flatMap\n};\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @example\n * import * as A from 'fp-ts/Array'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * A.chainFirst(() => ['a', 'b'])\n * ),\n * [1, 1, 2, 2, 3, 3]\n * )\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * A.chainFirst(() => [])\n * ),\n * []\n * )\n *\n * @category sequencing\n * @since 2.0.0\n */\nexport var chainFirst = \n/*#__PURE__*/ chainFirst_(Chain);\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Monad = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n chain: flatMap\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Unfoldable = {\n URI: URI,\n unfold: unfold\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Alt = {\n URI: URI,\n map: _map,\n alt: _alt\n};\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var Zero = {\n URI: URI,\n zero: zero\n};\n/**\n * @category do notation\n * @since 2.11.0\n */\nexport var guard = /*#__PURE__*/ guard_(Zero, Pointed);\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Alternative = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n alt: _alt,\n zero: zero\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Extend = {\n URI: URI,\n map: _map,\n extend: _extend\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Compactable = {\n URI: URI,\n compact: compact,\n separate: separate\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Filterable = {\n URI: URI,\n map: _map,\n compact: compact,\n separate: separate,\n filter: _filter,\n filterMap: _filterMap,\n partition: _partition,\n partitionMap: _partitionMap\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var FilterableWithIndex = {\n URI: URI,\n map: _map,\n mapWithIndex: _mapWithIndex,\n compact: compact,\n separate: separate,\n filter: _filter,\n filterMap: _filterMap,\n partition: _partition,\n partitionMap: _partitionMap,\n partitionMapWithIndex: _partitionMapWithIndex,\n partitionWithIndex: _partitionWithIndex,\n filterMapWithIndex: _filterMapWithIndex,\n filterWithIndex: _filterWithIndex\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Foldable = {\n URI: URI,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var FoldableWithIndex = {\n URI: URI,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n reduceWithIndex: _reduceWithIndex,\n foldMapWithIndex: _foldMapWithIndex,\n reduceRightWithIndex: _reduceRightWithIndex\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Traversable = {\n URI: URI,\n map: _map,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var TraversableWithIndex = {\n URI: URI,\n map: _map,\n mapWithIndex: _mapWithIndex,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n reduceWithIndex: _reduceWithIndex,\n foldMapWithIndex: _foldMapWithIndex,\n reduceRightWithIndex: _reduceRightWithIndex,\n traverse: _traverse,\n sequence: sequence,\n traverseWithIndex: _traverseWithIndex\n};\nvar _wither = /*#__PURE__*/ witherDefault(Traversable, Compactable);\nvar _wilt = /*#__PURE__*/ wiltDefault(Traversable, Compactable);\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Witherable = {\n URI: URI,\n map: _map,\n compact: compact,\n separate: separate,\n filter: _filter,\n filterMap: _filterMap,\n partition: _partition,\n partitionMap: _partitionMap,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence,\n wither: _wither,\n wilt: _wilt\n};\n/**\n * @category sequencing\n * @since 2.11.0\n */\nexport var chainRecDepthFirst = RA.chainRecDepthFirst;\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var ChainRecDepthFirst = {\n URI: URI,\n map: _map,\n ap: _ap,\n chain: flatMap,\n chainRec: _chainRecDepthFirst\n};\n/**\n * @category sequencing\n * @since 2.11.0\n */\nexport var chainRecBreadthFirst = RA.chainRecBreadthFirst;\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var ChainRecBreadthFirst = {\n URI: URI,\n map: _map,\n ap: _ap,\n chain: flatMap,\n chainRec: _chainRecBreadthFirst\n};\n/**\n * Filter values inside a context.\n *\n * @since 2.11.0\n */\nexport var filterE = /*#__PURE__*/ filterE_(Witherable);\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var FromEither = {\n URI: URI,\n fromEither: fromEither\n};\n/**\n * @category lifting\n * @since 2.11.0\n */\nexport var fromEitherK = /*#__PURE__*/ fromEitherK_(FromEither);\n// -------------------------------------------------------------------------------------\n// unsafe\n// -------------------------------------------------------------------------------------\n/**\n * @category unsafe\n * @since 2.0.0\n */\nexport var unsafeInsertAt = NEA.unsafeInsertAt;\n/**\n * @category unsafe\n * @since 2.0.0\n */\nexport var unsafeUpdateAt = function (i, a, as) {\n return isNonEmpty(as) ? NEA.unsafeUpdateAt(i, a, as) : [];\n};\n/**\n * @category unsafe\n * @since 2.0.0\n */\nexport var unsafeDeleteAt = function (i, as) {\n var xs = as.slice();\n xs.splice(i, 1);\n return xs;\n};\n// -------------------------------------------------------------------------------------\n// utils\n// -------------------------------------------------------------------------------------\n/**\n * `every` tells if the provided predicate holds true for every element in the `Array`.\n *\n * @example\n * import { every } from 'fp-ts/Array'\n *\n * assert.equal(every((x: number) => x >= 0)([1, 2, 3]), true);\n * assert.equal(every((x: number) => x >= 0)([-1, 2, 3]), false);\n *\n * @since 2.9.0\n */\nexport var every = RA.every;\n/**\n * `some` tells if the provided predicate holds true at least for one element in the `Array`.\n *\n * @example\n * import { some } from 'fp-ts/Array'\n *\n * assert.equal(some((x: number) => x >= 0)([1, 2, 3]), true);\n * assert.equal(some((x: number) => x >= 10)([1, 2, 3]), false);\n *\n * @since 2.9.0\n */\nexport var some = function (predicate) {\n return function (as) {\n return as.some(predicate);\n };\n};\n/**\n * Alias of [`some`](#some)\n *\n * @since 2.11.0\n */\nexport var exists = some;\n/**\n * Places an element in between members of an `Array`, then folds the results using the provided `Monoid`.\n *\n * @example\n * import * as S from 'fp-ts/string'\n * import { intercalate } from 'fp-ts/Array'\n *\n * assert.deepStrictEqual(intercalate(S.Monoid)('-')(['a', 'b', 'c']), 'a-b-c')\n *\n * @since 2.12.0\n */\nexport var intercalate = RA.intercalate;\n// -------------------------------------------------------------------------------------\n// do notation\n// -------------------------------------------------------------------------------------\n/**\n * @category do notation\n * @since 2.9.0\n */\nexport var Do = /*#__PURE__*/ of(_.emptyRecord);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bindTo = /*#__PURE__*/ bindTo_(Functor);\nvar let_ = /*#__PURE__*/ let__(Functor);\nexport { \n/**\n * @category do notation\n * @since 2.13.0\n */\nlet_ as let };\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bind = /*#__PURE__*/ bind_(Chain);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var apS = /*#__PURE__*/ apS_(Apply);\n// -------------------------------------------------------------------------------------\n// legacy\n// -------------------------------------------------------------------------------------\n/**\n * Alias of `flatMap`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var chain = flatMap;\n// -------------------------------------------------------------------------------------\n// deprecated\n// -------------------------------------------------------------------------------------\n/**\n * Use `NonEmptyArray` module instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var range = NEA.range;\n/**\n * Use a new `[]` instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var empty = [];\n/**\n * Use `prepend` instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var cons = NEA.cons;\n/**\n * Use `append` instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var snoc = NEA.snoc;\n/**\n * Use `prependAll` instead\n *\n * @category zone of death\n * @since 2.9.0\n * @deprecated\n */\nexport var prependToAll = prependAll;\n/**\n * This instance is deprecated, use small, specific instances instead.\n * For example if a function needs a `Functor` instance, pass `A.Functor` instead of `A.array`\n * (where `A` is from `import A from 'fp-ts/Array'`)\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var array = {\n URI: URI,\n compact: compact,\n separate: separate,\n map: _map,\n ap: _ap,\n of: of,\n chain: flatMap,\n filter: _filter,\n filterMap: _filterMap,\n partition: _partition,\n partitionMap: _partitionMap,\n mapWithIndex: _mapWithIndex,\n partitionMapWithIndex: _partitionMapWithIndex,\n partitionWithIndex: _partitionWithIndex,\n filterMapWithIndex: _filterMapWithIndex,\n filterWithIndex: _filterWithIndex,\n alt: _alt,\n zero: zero,\n unfold: unfold,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence,\n reduceWithIndex: _reduceWithIndex,\n foldMapWithIndex: _foldMapWithIndex,\n reduceRightWithIndex: _reduceRightWithIndex,\n traverseWithIndex: _traverseWithIndex,\n extend: _extend,\n wither: _wither,\n wilt: _wilt\n};\n","export function chainFirst(M) {\n var tapM = tap(M);\n return function (f) { return function (first) { return tapM(first, f); }; };\n}\n/** @internal */\nexport function tap(M) {\n return function (first, f) { return M.chain(first, function (a) { return M.map(f(a), function () { return a; }); }); };\n}\nexport function bind(M) {\n return function (name, f) { return function (ma) { return M.chain(ma, function (a) { return M.map(f(a), function (b) {\n var _a;\n return Object.assign({}, a, (_a = {}, _a[name] = b, _a));\n }); }); }; };\n}\n","/**\n * @since 2.0.0\n */\nexport var tailRec = function (startWith, f) {\n var ab = f(startWith);\n while (ab._tag === 'Left') {\n ab = f(ab.left);\n }\n return ab.right;\n};\n","import { getApplicativeMonoid } from './Applicative';\nimport { apFirst as apFirst_, apS as apS_, apSecond as apSecond_, getApplySemigroup as getApplySemigroup_ } from './Apply';\nimport * as chainable from './Chain';\nimport { tailRec } from './ChainRec';\nimport { chainOptionK as chainOptionK_, filterOrElse as filterOrElse_, fromOption as fromOption_, fromOptionK as fromOptionK_, fromPredicate as fromPredicate_ } from './FromEither';\nimport { dual, flow, identity, pipe } from './function';\nimport { as as as_, asUnit as asUnit_, bindTo as bindTo_, flap as flap_, let as let__ } from './Functor';\nimport * as _ from './internal';\nimport { separated } from './Separated';\nimport { wiltDefault, witherDefault } from './Witherable';\n// -------------------------------------------------------------------------------------\n// constructors\n// -------------------------------------------------------------------------------------\n/**\n * Constructs a new `Either` holding a `Left` value. This usually represents a failure, due to the right-bias of this\n * structure.\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var left = _.left;\n/**\n * Constructs a new `Either` holding a `Right` value. This usually represents a successful value due to the right bias\n * of this structure.\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var right = _.right;\n/**\n * @category sequencing\n * @since 2.14.0\n */\nexport var flatMap = /*#__PURE__*/ dual(2, function (ma, f) { return (isLeft(ma) ? ma : f(ma.right)); });\nvar _map = function (fa, f) { return pipe(fa, map(f)); };\nvar _ap = function (fab, fa) { return pipe(fab, ap(fa)); };\n/* istanbul ignore next */\nvar _reduce = function (fa, b, f) { return pipe(fa, reduce(b, f)); };\n/* istanbul ignore next */\nvar _foldMap = function (M) { return function (fa, f) {\n var foldMapM = foldMap(M);\n return pipe(fa, foldMapM(f));\n}; };\n/* istanbul ignore next */\nvar _reduceRight = function (fa, b, f) { return pipe(fa, reduceRight(b, f)); };\nvar _traverse = function (F) {\n var traverseF = traverse(F);\n return function (ta, f) { return pipe(ta, traverseF(f)); };\n};\nvar _bimap = function (fa, f, g) { return pipe(fa, bimap(f, g)); };\nvar _mapLeft = function (fa, f) { return pipe(fa, mapLeft(f)); };\n/* istanbul ignore next */\nvar _alt = function (fa, that) { return pipe(fa, alt(that)); };\n/* istanbul ignore next */\nvar _extend = function (wa, f) { return pipe(wa, extend(f)); };\nvar _chainRec = function (a, f) {\n return tailRec(f(a), function (e) {\n return isLeft(e) ? right(left(e.left)) : isLeft(e.right) ? left(f(e.right.left)) : right(right(e.right.right));\n });\n};\n/**\n * @category type lambdas\n * @since 2.0.0\n */\nexport var URI = 'Either';\n/**\n * @category instances\n * @since 2.0.0\n */\nexport var getShow = function (SE, SA) { return ({\n show: function (ma) { return (isLeft(ma) ? \"left(\".concat(SE.show(ma.left), \")\") : \"right(\".concat(SA.show(ma.right), \")\")); }\n}); };\n/**\n * @category instances\n * @since 2.0.0\n */\nexport var getEq = function (EL, EA) { return ({\n equals: function (x, y) {\n return x === y || (isLeft(x) ? isLeft(y) && EL.equals(x.left, y.left) : isRight(y) && EA.equals(x.right, y.right));\n }\n}); };\n/**\n * Semigroup returning the left-most non-`Left` value. If both operands are `Right`s then the inner values are\n * concatenated using the provided `Semigroup`\n *\n * @example\n * import { getSemigroup, left, right } from 'fp-ts/Either'\n * import { SemigroupSum } from 'fp-ts/number'\n *\n * const S = getSemigroup(SemigroupSum)\n * assert.deepStrictEqual(S.concat(left('a'), left('b')), left('a'))\n * assert.deepStrictEqual(S.concat(left('a'), right(2)), right(2))\n * assert.deepStrictEqual(S.concat(right(1), left('b')), right(1))\n * assert.deepStrictEqual(S.concat(right(1), right(2)), right(3))\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getSemigroup = function (S) { return ({\n concat: function (x, y) { return (isLeft(y) ? x : isLeft(x) ? y : right(S.concat(x.right, y.right))); }\n}); };\n/**\n * Builds a `Compactable` instance for `Either` given `Monoid` for the left side.\n *\n * @category filtering\n * @since 2.10.0\n */\nexport var getCompactable = function (M) {\n var empty = left(M.empty);\n return {\n URI: URI,\n _E: undefined,\n compact: function (ma) { return (isLeft(ma) ? ma : ma.right._tag === 'None' ? empty : right(ma.right.value)); },\n separate: function (ma) {\n return isLeft(ma)\n ? separated(ma, ma)\n : isLeft(ma.right)\n ? separated(right(ma.right.left), empty)\n : separated(empty, right(ma.right.right));\n }\n };\n};\n/**\n * Builds a `Filterable` instance for `Either` given `Monoid` for the left side\n *\n * @category filtering\n * @since 2.10.0\n */\nexport var getFilterable = function (M) {\n var empty = left(M.empty);\n var _a = getCompactable(M), compact = _a.compact, separate = _a.separate;\n var filter = function (ma, predicate) {\n return isLeft(ma) ? ma : predicate(ma.right) ? ma : empty;\n };\n var partition = function (ma, p) {\n return isLeft(ma)\n ? separated(ma, ma)\n : p(ma.right)\n ? separated(empty, right(ma.right))\n : separated(right(ma.right), empty);\n };\n return {\n URI: URI,\n _E: undefined,\n map: _map,\n compact: compact,\n separate: separate,\n filter: filter,\n filterMap: function (ma, f) {\n if (isLeft(ma)) {\n return ma;\n }\n var ob = f(ma.right);\n return ob._tag === 'None' ? empty : right(ob.value);\n },\n partition: partition,\n partitionMap: function (ma, f) {\n if (isLeft(ma)) {\n return separated(ma, ma);\n }\n var e = f(ma.right);\n return isLeft(e) ? separated(right(e.left), empty) : separated(empty, right(e.right));\n }\n };\n};\n/**\n * Builds `Witherable` instance for `Either` given `Monoid` for the left side\n *\n * @category filtering\n * @since 2.0.0\n */\nexport var getWitherable = function (M) {\n var F_ = getFilterable(M);\n var C = getCompactable(M);\n return {\n URI: URI,\n _E: undefined,\n map: _map,\n compact: F_.compact,\n separate: F_.separate,\n filter: F_.filter,\n filterMap: F_.filterMap,\n partition: F_.partition,\n partitionMap: F_.partitionMap,\n traverse: _traverse,\n sequence: sequence,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n wither: witherDefault(Traversable, C),\n wilt: wiltDefault(Traversable, C)\n };\n};\n/**\n * The default [`Applicative`](#applicative) instance returns the first error, if you want to\n * get all errors you need to provide a way to concatenate them via a `Semigroup`.\n *\n * @example\n * import * as A from 'fp-ts/Apply'\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n * import * as S from 'fp-ts/Semigroup'\n * import * as string from 'fp-ts/string'\n *\n * const parseString = (u: unknown): E.Either =>\n * typeof u === 'string' ? E.right(u) : E.left('not a string')\n *\n * const parseNumber = (u: unknown): E.Either =>\n * typeof u === 'number' ? E.right(u) : E.left('not a number')\n *\n * interface Person {\n * readonly name: string\n * readonly age: number\n * }\n *\n * const parsePerson = (\n * input: Record\n * ): E.Either =>\n * pipe(\n * E.Do,\n * E.apS('name', parseString(input.name)),\n * E.apS('age', parseNumber(input.age))\n * )\n *\n * assert.deepStrictEqual(parsePerson({}), E.left('not a string')) // <= first error\n *\n * const Applicative = E.getApplicativeValidation(\n * pipe(string.Semigroup, S.intercalate(', '))\n * )\n *\n * const apS = A.apS(Applicative)\n *\n * const parsePersonAll = (\n * input: Record\n * ): E.Either =>\n * pipe(\n * E.Do,\n * apS('name', parseString(input.name)),\n * apS('age', parseNumber(input.age))\n * )\n *\n * assert.deepStrictEqual(parsePersonAll({}), E.left('not a string, not a number')) // <= all errors\n *\n * @category error handling\n * @since 2.7.0\n */\nexport var getApplicativeValidation = function (SE) { return ({\n URI: URI,\n _E: undefined,\n map: _map,\n ap: function (fab, fa) {\n return isLeft(fab)\n ? isLeft(fa)\n ? left(SE.concat(fab.left, fa.left))\n : fab\n : isLeft(fa)\n ? fa\n : right(fab.right(fa.right));\n },\n of: of\n}); };\n/**\n * The default [`Alt`](#alt) instance returns the last error, if you want to\n * get all errors you need to provide a way to concatenate them via a `Semigroup`.\n *\n * @example\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n * import * as S from 'fp-ts/Semigroup'\n * import * as string from 'fp-ts/string'\n *\n * const parseString = (u: unknown): E.Either =>\n * typeof u === 'string' ? E.right(u) : E.left('not a string')\n *\n * const parseNumber = (u: unknown): E.Either =>\n * typeof u === 'number' ? E.right(u) : E.left('not a number')\n *\n * const parse = (u: unknown): E.Either =>\n * pipe(\n * parseString(u),\n * E.alt(() => parseNumber(u))\n * )\n *\n * assert.deepStrictEqual(parse(true), E.left('not a number')) // <= last error\n *\n * const Alt = E.getAltValidation(pipe(string.Semigroup, S.intercalate(', ')))\n *\n * const parseAll = (u: unknown): E.Either =>\n * Alt.alt(parseString(u), () => parseNumber(u))\n *\n * assert.deepStrictEqual(parseAll(true), E.left('not a string, not a number')) // <= all errors\n *\n * @category error handling\n * @since 2.7.0\n */\nexport var getAltValidation = function (SE) { return ({\n URI: URI,\n _E: undefined,\n map: _map,\n alt: function (me, that) {\n if (isRight(me)) {\n return me;\n }\n var ea = that();\n return isLeft(ea) ? left(SE.concat(me.left, ea.left)) : ea;\n }\n}); };\n/**\n * @category mapping\n * @since 2.0.0\n */\nexport var map = function (f) { return function (fa) {\n return isLeft(fa) ? fa : right(f(fa.right));\n}; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Functor = {\n URI: URI,\n map: _map\n};\n/**\n * Maps the `Right` value of this `Either` to the specified constant value.\n *\n * @category mapping\n * @since 2.16.0\n */\nexport var as = dual(2, as_(Functor));\n/**\n * Maps the `Right` value of this `Either` to the void constant value.\n *\n * @category mapping\n * @since 2.16.0\n */\nexport var asUnit = asUnit_(Functor);\n/**\n * @category constructors\n * @since 2.7.0\n */\nexport var of = right;\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Pointed = {\n URI: URI,\n of: of\n};\n/**\n * Less strict version of [`ap`](#ap).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @since 2.8.0\n */\nexport var apW = function (fa) { return function (fab) {\n return isLeft(fab) ? fab : isLeft(fa) ? fa : right(fab.right(fa.right));\n}; };\n/**\n * @since 2.0.0\n */\nexport var ap = apW;\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Apply = {\n URI: URI,\n map: _map,\n ap: _ap\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Applicative = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Chain = {\n URI: URI,\n map: _map,\n ap: _ap,\n chain: flatMap\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Monad = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n chain: flatMap\n};\n/**\n * Left-associative fold of a structure.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as E from 'fp-ts/Either'\n *\n * const startWith = 'prefix'\n * const concat = (a: string, b: string) => `${a}:${b}`\n *\n * assert.deepStrictEqual(\n * pipe(E.right('a'), E.reduce(startWith, concat)),\n * 'prefix:a'\n * )\n *\n * assert.deepStrictEqual(\n * pipe(E.left('e'), E.reduce(startWith, concat)),\n * 'prefix'\n * )\n *\n * @category folding\n * @since 2.0.0\n */\nexport var reduce = function (b, f) { return function (fa) {\n return isLeft(fa) ? b : f(b, fa.right);\n}; };\n/**\n * Map each element of the structure to a monoid, and combine the results.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as E from 'fp-ts/Either'\n * import * as S from 'fp-ts/string'\n *\n * const yell = (a: string) => `${a}!`\n *\n * assert.deepStrictEqual(\n * pipe(E.right('a'), E.foldMap(S.Monoid)(yell)),\n * 'a!'\n * )\n *\n * assert.deepStrictEqual(\n * pipe(E.left('e'), E.foldMap(S.Monoid)(yell)),\n * S.Monoid.empty\n * )\n *\n * @category folding\n * @since 2.0.0\n */\nexport var foldMap = function (M) { return function (f) { return function (fa) {\n return isLeft(fa) ? M.empty : f(fa.right);\n}; }; };\n/**\n * Right-associative fold of a structure.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as E from 'fp-ts/Either'\n *\n * const startWith = 'postfix'\n * const concat = (a: string, b: string) => `${a}:${b}`\n *\n * assert.deepStrictEqual(\n * pipe(E.right('a'), E.reduceRight(startWith, concat)),\n * 'a:postfix'\n * )\n *\n * assert.deepStrictEqual(\n * pipe(E.left('e'), E.reduceRight(startWith, concat)),\n * 'postfix'\n * )\n *\n * @category folding\n * @since 2.0.0\n */\nexport var reduceRight = function (b, f) { return function (fa) {\n return isLeft(fa) ? b : f(fa.right, b);\n}; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Foldable = {\n URI: URI,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight\n};\n/**\n * Map each element of a structure to an action, evaluate these actions from left to right, and collect the results.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import * as E from 'fp-ts/Either'\n * import * as O from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(\n * pipe(E.right(['a']), E.traverse(O.Applicative)(RA.head)),\n * O.some(E.right('a'))\n * )\n *\n * assert.deepStrictEqual(\n * pipe(E.right([]), E.traverse(O.Applicative)(RA.head)),\n * O.none\n * )\n *\n * @category traversing\n * @since 2.6.3\n */\nexport var traverse = function (F) {\n return function (f) {\n return function (ta) {\n return isLeft(ta) ? F.of(left(ta.left)) : F.map(f(ta.right), right);\n };\n };\n};\n/**\n * Evaluate each monadic action in the structure from left to right, and collect the results.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as E from 'fp-ts/Either'\n * import * as O from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(\n * pipe(E.right(O.some('a')), E.sequence(O.Applicative)),\n * O.some(E.right('a'))\n * )\n *\n * assert.deepStrictEqual(\n * pipe(E.right(O.none), E.sequence(O.Applicative)),\n * O.none\n * )\n *\n * @category traversing\n * @since 2.6.3\n */\nexport var sequence = function (F) {\n return function (ma) {\n return isLeft(ma) ? F.of(left(ma.left)) : F.map(ma.right, right);\n };\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Traversable = {\n URI: URI,\n map: _map,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence\n};\n/**\n * Map a pair of functions over the two type arguments of the bifunctor.\n *\n * @category mapping\n * @since 2.0.0\n */\nexport var bimap = function (f, g) { return function (fa) {\n return isLeft(fa) ? left(f(fa.left)) : right(g(fa.right));\n}; };\n/**\n * Map a function over the first type argument of a bifunctor.\n *\n * @category error handling\n * @since 2.0.0\n */\nexport var mapLeft = function (f) { return function (fa) {\n return isLeft(fa) ? left(f(fa.left)) : fa;\n}; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Bifunctor = {\n URI: URI,\n bimap: _bimap,\n mapLeft: _mapLeft\n};\n/**\n * Less strict version of [`alt`](#alt).\n *\n * The `W` suffix (short for **W**idening) means that the error and the return types will be merged.\n *\n * @category error handling\n * @since 2.9.0\n */\nexport var altW = function (that) { return function (fa) {\n return isLeft(fa) ? that() : fa;\n}; };\n/**\n * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to\n * types of kind `* -> *`.\n *\n * In case of `Either` returns the left-most non-`Left` value (or the right-most `Left` value if both values are `Left`).\n *\n * | x | y | pipe(x, alt(() => y) |\n * | -------- | -------- | -------------------- |\n * | left(a) | left(b) | left(b) |\n * | left(a) | right(2) | right(2) |\n * | right(1) | left(b) | right(1) |\n * | right(1) | right(2) | right(1) |\n *\n * @example\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * E.left('a'),\n * E.alt(() => E.left('b'))\n * ),\n * E.left('b')\n * )\n * assert.deepStrictEqual(\n * pipe(\n * E.left('a'),\n * E.alt(() => E.right(2))\n * ),\n * E.right(2)\n * )\n * assert.deepStrictEqual(\n * pipe(\n * E.right(1),\n * E.alt(() => E.left('b'))\n * ),\n * E.right(1)\n * )\n * assert.deepStrictEqual(\n * pipe(\n * E.right(1),\n * E.alt(() => E.right(2))\n * ),\n * E.right(1)\n * )\n *\n * @category error handling\n * @since 2.0.0\n */\nexport var alt = altW;\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Alt = {\n URI: URI,\n map: _map,\n alt: _alt\n};\n/**\n * @since 2.0.0\n */\nexport var extend = function (f) { return function (wa) {\n return isLeft(wa) ? wa : right(f(wa));\n}; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Extend = {\n URI: URI,\n map: _map,\n extend: _extend\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var ChainRec = {\n URI: URI,\n map: _map,\n ap: _ap,\n chain: flatMap,\n chainRec: _chainRec\n};\n/**\n * @since 2.6.3\n */\nexport var throwError = left;\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var MonadThrow = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n chain: flatMap,\n throwError: throwError\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var FromEither = {\n URI: URI,\n fromEither: identity\n};\n/**\n * @example\n * import { fromPredicate, left, right } from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * 1,\n * fromPredicate(\n * (n) => n > 0,\n * () => 'error'\n * )\n * ),\n * right(1)\n * )\n * assert.deepStrictEqual(\n * pipe(\n * -1,\n * fromPredicate(\n * (n) => n > 0,\n * () => 'error'\n * )\n * ),\n * left('error')\n * )\n *\n * @category lifting\n * @since 2.0.0\n */\nexport var fromPredicate = /*#__PURE__*/ fromPredicate_(FromEither);\n// -------------------------------------------------------------------------------------\n// conversions\n// -------------------------------------------------------------------------------------\n/**\n * @example\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n * import * as O from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(\n * pipe(\n * O.some(1),\n * E.fromOption(() => 'error')\n * ),\n * E.right(1)\n * )\n * assert.deepStrictEqual(\n * pipe(\n * O.none,\n * E.fromOption(() => 'error')\n * ),\n * E.left('error')\n * )\n *\n * @category conversions\n * @since 2.0.0\n */\nexport var fromOption = \n/*#__PURE__*/ fromOption_(FromEither);\n// -------------------------------------------------------------------------------------\n// refinements\n// -------------------------------------------------------------------------------------\n/**\n * Returns `true` if the either is an instance of `Left`, `false` otherwise.\n *\n * @category refinements\n * @since 2.0.0\n */\nexport var isLeft = _.isLeft;\n/**\n * Returns `true` if the either is an instance of `Right`, `false` otherwise.\n *\n * @category refinements\n * @since 2.0.0\n */\nexport var isRight = _.isRight;\n/**\n * Less strict version of [`match`](#match).\n *\n * The `W` suffix (short for **W**idening) means that the handler return types will be merged.\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var matchW = function (onLeft, onRight) {\n return function (ma) {\n return isLeft(ma) ? onLeft(ma.left) : onRight(ma.right);\n };\n};\n/**\n * Alias of [`matchW`](#matchw).\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var foldW = matchW;\n/**\n * Takes two functions and an `Either` value, if the value is a `Left` the inner value is applied to the first function,\n * if the value is a `Right` the inner value is applied to the second function.\n *\n * @example\n * import { match, left, right } from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n *\n * function onLeft(errors: Array): string {\n * return `Errors: ${errors.join(', ')}`\n * }\n *\n * function onRight(value: number): string {\n * return `Ok: ${value}`\n * }\n *\n * assert.strictEqual(\n * pipe(\n * right(1),\n * match(onLeft, onRight)\n * ),\n * 'Ok: 1'\n * )\n * assert.strictEqual(\n * pipe(\n * left(['error 1', 'error 2']),\n * match(onLeft, onRight)\n * ),\n * 'Errors: error 1, error 2'\n * )\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var match = matchW;\n/**\n * Alias of [`match`](#match).\n *\n * @category pattern matching\n * @since 2.0.0\n */\nexport var fold = match;\n/**\n * Less strict version of [`getOrElse`](#getorelse).\n *\n * The `W` suffix (short for **W**idening) means that the handler return type will be merged.\n *\n * @category error handling\n * @since 2.6.0\n */\nexport var getOrElseW = function (onLeft) {\n return function (ma) {\n return isLeft(ma) ? onLeft(ma.left) : ma.right;\n };\n};\n/**\n * Returns the wrapped value if it's a `Right` or a default value if is a `Left`.\n *\n * @example\n * import { getOrElse, left, right } from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * right(1),\n * getOrElse(() => 0)\n * ),\n * 1\n * )\n * assert.deepStrictEqual(\n * pipe(\n * left('error'),\n * getOrElse(() => 0)\n * ),\n * 0\n * )\n *\n * @category error handling\n * @since 2.0.0\n */\nexport var getOrElse = getOrElseW;\n// -------------------------------------------------------------------------------------\n// combinators\n// -------------------------------------------------------------------------------------\n/**\n * @category mapping\n * @since 2.10.0\n */\nexport var flap = /*#__PURE__*/ flap_(Functor);\n/**\n * Combine two effectful actions, keeping only the result of the first.\n *\n * @since 2.0.0\n */\nexport var apFirst = /*#__PURE__*/ apFirst_(Apply);\n/**\n * Less strict version of [`apFirst`](#apfirst)\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @since 2.12.0\n */\nexport var apFirstW = apFirst;\n/**\n * Combine two effectful actions, keeping only the result of the second.\n *\n * @since 2.0.0\n */\nexport var apSecond = /*#__PURE__*/ apSecond_(Apply);\n/**\n * Less strict version of [`apSecond`](#apsecond)\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @since 2.12.0\n */\nexport var apSecondW = apSecond;\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @category combinators\n * @since 2.15.0\n */\nexport var tap = /*#__PURE__*/ dual(2, chainable.tap(Chain));\n/**\n * Less strict version of [`flatten`](#flatten).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category sequencing\n * @since 2.11.0\n */\nexport var flattenW = \n/*#__PURE__*/ flatMap(identity);\n/**\n * The `flatten` function is the conventional monad join operator. It is used to remove one level of monadic structure, projecting its bound argument into the outer level.\n *\n * @example\n * import * as E from 'fp-ts/Either'\n *\n * assert.deepStrictEqual(E.flatten(E.right(E.right('a'))), E.right('a'))\n * assert.deepStrictEqual(E.flatten(E.right(E.left('e'))), E.left('e'))\n * assert.deepStrictEqual(E.flatten(E.left('e')), E.left('e'))\n *\n * @category sequencing\n * @since 2.0.0\n */\nexport var flatten = flattenW;\n/**\n * @since 2.0.0\n */\nexport var duplicate = /*#__PURE__*/ extend(identity);\n/**\n * Use `liftOption`.\n *\n * @category legacy\n * @since 2.10.0\n */\nexport var fromOptionK = \n/*#__PURE__*/ fromOptionK_(FromEither);\n/**\n * Use `flatMapOption`.\n *\n * @category legacy\n * @since 2.11.0\n */\nexport var chainOptionK = /*#__PURE__*/ chainOptionK_(FromEither, Chain);\n/**\n * Use `flatMapOption`.\n *\n * @category legacy\n * @since 2.13.2\n */\nexport var chainOptionKW = chainOptionK;\n/** @internal */\nvar _FromEither = {\n fromEither: FromEither.fromEither\n};\n/**\n * @category lifting\n * @since 2.15.0\n */\nexport var liftNullable = /*#__PURE__*/ _.liftNullable(_FromEither);\n/**\n * @category lifting\n * @since 2.15.0\n */\nexport var liftOption = /*#__PURE__*/ _.liftOption(_FromEither);\n/** @internal */\nvar _FlatMap = {\n flatMap: flatMap\n};\n/**\n * @category sequencing\n * @since 2.15.0\n */\nexport var flatMapNullable = /*#__PURE__*/ _.flatMapNullable(_FromEither, _FlatMap);\n/**\n * @category sequencing\n * @since 2.15.0\n */\nexport var flatMapOption = /*#__PURE__*/ _.flatMapOption(_FromEither, _FlatMap);\n/**\n * @example\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * E.right(1),\n * E.filterOrElse(\n * (n) => n > 0,\n * () => 'error'\n * )\n * ),\n * E.right(1)\n * )\n * assert.deepStrictEqual(\n * pipe(\n * E.right(-1),\n * E.filterOrElse(\n * (n) => n > 0,\n * () => 'error'\n * )\n * ),\n * E.left('error')\n * )\n * assert.deepStrictEqual(\n * pipe(\n * E.left('a'),\n * E.filterOrElse(\n * (n) => n > 0,\n * () => 'error'\n * )\n * ),\n * E.left('a')\n * )\n *\n * @category filtering\n * @since 2.0.0\n */\nexport var filterOrElse = /*#__PURE__*/ filterOrElse_(FromEither, Chain);\n/**\n * Less strict version of [`filterOrElse`](#filterorelse).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category filtering\n * @since 2.9.0\n */\nexport var filterOrElseW = filterOrElse;\n/**\n * Returns a `Right` if is a `Left` (and vice versa).\n *\n * @since 2.0.0\n */\nexport var swap = function (ma) { return (isLeft(ma) ? right(ma.left) : left(ma.right)); };\n/**\n * Less strict version of [`orElse`](#orelse).\n *\n * The `W` suffix (short for **W**idening) means that the return types will be merged.\n *\n * @category error handling\n * @since 2.10.0\n */\nexport var orElseW = function (onLeft) {\n return function (ma) {\n return isLeft(ma) ? onLeft(ma.left) : ma;\n };\n};\n/**\n * Useful for recovering from errors.\n *\n * @category error handling\n * @since 2.0.0\n */\nexport var orElse = orElseW;\n/**\n * Takes a default and a nullable value, if the value is not nully, turn it into a `Right`, if the value is nully use\n * the provided default as a `Left`.\n *\n * @example\n * import { fromNullable, left, right } from 'fp-ts/Either'\n *\n * const parse = fromNullable('nully')\n *\n * assert.deepStrictEqual(parse(1), right(1))\n * assert.deepStrictEqual(parse(null), left('nully'))\n *\n * @category conversions\n * @since 2.0.0\n */\nexport var fromNullable = function (e) {\n return function (a) {\n return a == null ? left(e) : right(a);\n };\n};\n/**\n * Constructs a new `Either` from a function that might throw.\n *\n * See also [`tryCatchK`](#trycatchk).\n *\n * @example\n * import * as E from 'fp-ts/Either'\n *\n * const unsafeHead = (as: ReadonlyArray): A => {\n * if (as.length > 0) {\n * return as[0]\n * } else {\n * throw new Error('empty array')\n * }\n * }\n *\n * const head = (as: ReadonlyArray): E.Either =>\n * E.tryCatch(() => unsafeHead(as), e => (e instanceof Error ? e : new Error('unknown error')))\n *\n * assert.deepStrictEqual(head([]), E.left(new Error('empty array')))\n * assert.deepStrictEqual(head([1, 2, 3]), E.right(1))\n *\n * @category interop\n * @since 2.0.0\n */\nexport var tryCatch = function (f, onThrow) {\n try {\n return right(f());\n }\n catch (e) {\n return left(onThrow(e));\n }\n};\n/**\n * Converts a function that may throw to one returning a `Either`.\n *\n * @category interop\n * @since 2.10.0\n */\nexport var tryCatchK = function (f, onThrow) {\n return function () {\n var a = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n a[_i] = arguments[_i];\n }\n return tryCatch(function () { return f.apply(void 0, a); }, onThrow);\n };\n};\n/**\n * Use `liftNullable`.\n *\n * @category legacy\n * @since 2.9.0\n */\nexport var fromNullableK = function (e) {\n var from = fromNullable(e);\n return function (f) { return flow(f, from); };\n};\n/**\n * Use `flatMapNullable`.\n *\n * @category legacy\n * @since 2.9.0\n */\nexport var chainNullableK = function (e) {\n var from = fromNullableK(e);\n return function (f) { return flatMap(from(f)); };\n};\n/**\n * @category conversions\n * @since 2.10.0\n */\nexport var toUnion = /*#__PURE__*/ foldW(identity, identity);\n// -------------------------------------------------------------------------------------\n// utils\n// -------------------------------------------------------------------------------------\n/**\n * Default value for the `onError` argument of `tryCatch`\n *\n * @since 2.0.0\n */\nexport function toError(e) {\n return e instanceof Error ? e : new Error(String(e));\n}\nexport function elem(E) {\n return function (a, ma) {\n if (ma === undefined) {\n var elemE_1 = elem(E);\n return function (ma) { return elemE_1(a, ma); };\n }\n return isLeft(ma) ? false : E.equals(a, ma.right);\n };\n}\n/**\n * Returns `false` if `Left` or returns the result of the application of the given predicate to the `Right` value.\n *\n * @example\n * import { exists, left, right } from 'fp-ts/Either'\n *\n * const gt2 = exists((n: number) => n > 2)\n *\n * assert.strictEqual(gt2(left('a')), false)\n * assert.strictEqual(gt2(right(1)), false)\n * assert.strictEqual(gt2(right(3)), true)\n *\n * @since 2.0.0\n */\nexport var exists = function (predicate) {\n return function (ma) {\n return isLeft(ma) ? false : predicate(ma.right);\n };\n};\n// -------------------------------------------------------------------------------------\n// do notation\n// -------------------------------------------------------------------------------------\n/**\n * @category do notation\n * @since 2.9.0\n */\nexport var Do = /*#__PURE__*/ of(_.emptyRecord);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bindTo = /*#__PURE__*/ bindTo_(Functor);\nvar let_ = /*#__PURE__*/ let__(Functor);\nexport { \n/**\n * @category do notation\n * @since 2.13.0\n */\nlet_ as let };\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bind = /*#__PURE__*/ chainable.bind(Chain);\n/**\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category do notation\n * @since 2.8.0\n */\nexport var bindW = bind;\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var apS = /*#__PURE__*/ apS_(Apply);\n/**\n * Less strict version of [`apS`](#aps).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category do notation\n * @since 2.8.0\n */\nexport var apSW = apS;\n/**\n * @since 2.11.0\n */\nexport var ApT = /*#__PURE__*/ of(_.emptyReadonlyArray);\n// -------------------------------------------------------------------------------------\n// array utils\n// -------------------------------------------------------------------------------------\n/**\n * Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(Applicative)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyNonEmptyArrayWithIndex = function (f) {\n return function (as) {\n var e = f(0, _.head(as));\n if (isLeft(e)) {\n return e;\n }\n var out = [e.right];\n for (var i = 1; i < as.length; i++) {\n var e_1 = f(i, as[i]);\n if (isLeft(e_1)) {\n return e_1;\n }\n out.push(e_1.right);\n }\n return right(out);\n };\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyArrayWithIndex = function (f) {\n var g = traverseReadonlyNonEmptyArrayWithIndex(f);\n return function (as) { return (_.isNonEmpty(as) ? g(as) : ApT); };\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseArrayWithIndex = traverseReadonlyArrayWithIndex;\n/**\n * Equivalent to `ReadonlyArray#traverse(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseArray = function (f) { return traverseReadonlyArrayWithIndex(function (_, a) { return f(a); }); };\n/**\n * Equivalent to `ReadonlyArray#sequence(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var sequenceArray = \n/*#__PURE__*/ traverseArray(identity);\n// -------------------------------------------------------------------------------------\n// legacy\n// -------------------------------------------------------------------------------------\n/**\n * Alias of `flatMap`.\n *\n * @category legacy\n * @since 2.6.0\n */\nexport var chainW = flatMap;\n/**\n * Alias of `flatMap`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var chain = flatMap;\n/**\n * Alias of `tap`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var chainFirst = tap;\n/**\n * Alias of `tap`.\n *\n * @category legacy\n * @since 2.8.0\n */\nexport var chainFirstW = tap;\n/**\n * Use [`parse`](./Json.ts.html#parse) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport function parseJSON(s, onError) {\n return tryCatch(function () { return JSON.parse(s); }, onError);\n}\n/**\n * Use [`stringify`](./Json.ts.html#stringify) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var stringifyJSON = function (u, onError) {\n return tryCatch(function () {\n var s = JSON.stringify(u);\n if (typeof s !== 'string') {\n throw new Error('Converting unsupported structure to JSON');\n }\n return s;\n }, onError);\n};\n/**\n * This instance is deprecated, use small, specific instances instead.\n * For example if a function needs a `Functor` instance, pass `E.Functor` instead of `E.either`\n * (where `E` is from `import E from 'fp-ts/Either'`)\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var either = {\n URI: URI,\n map: _map,\n of: of,\n ap: _ap,\n chain: flatMap,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence,\n bimap: _bimap,\n mapLeft: _mapLeft,\n alt: _alt,\n extend: _extend,\n chainRec: _chainRec,\n throwError: throwError\n};\n/**\n * Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.\n *\n * Semigroup returning the left-most `Left` value. If both operands are `Right`s then the inner values\n * are concatenated using the provided `Semigroup`\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getApplySemigroup = \n/*#__PURE__*/ getApplySemigroup_(Apply);\n/**\n * Use [`getApplicativeMonoid`](./Applicative.ts.html#getapplicativemonoid) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getApplyMonoid = \n/*#__PURE__*/ getApplicativeMonoid(Applicative);\n/**\n * Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getValidationSemigroup = function (SE, SA) {\n return getApplySemigroup_(getApplicativeValidation(SE))(SA);\n};\n/**\n * Use [`getApplicativeMonoid`](./Applicative.ts.html#getapplicativemonoid) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getValidationMonoid = function (SE, MA) {\n return getApplicativeMonoid(getApplicativeValidation(SE))(MA);\n};\n/**\n * Use [`getApplicativeValidation`](#getapplicativevalidation) and [`getAltValidation`](#getaltvalidation) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport function getValidation(SE) {\n var ap = getApplicativeValidation(SE).ap;\n var alt = getAltValidation(SE).alt;\n return {\n URI: URI,\n _E: undefined,\n map: _map,\n of: of,\n chain: flatMap,\n bimap: _bimap,\n mapLeft: _mapLeft,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n extend: _extend,\n traverse: _traverse,\n sequence: sequence,\n chainRec: _chainRec,\n throwError: throwError,\n ap: ap,\n alt: alt\n };\n}\n","import { ap as ap_ } from './Apply';\nimport * as E from './Either';\nimport { flow, pipe } from './function';\nimport { map as map_ } from './Functor';\nexport function right(F) {\n return flow(E.right, F.of);\n}\nexport function left(F) {\n return flow(E.left, F.of);\n}\nexport function rightF(F) {\n return function (fa) { return F.map(fa, E.right); };\n}\nexport function leftF(F) {\n return function (fe) { return F.map(fe, E.left); };\n}\nexport function fromNullable(F) {\n return function (e) { return flow(E.fromNullable(e), F.of); };\n}\nexport function fromNullableK(F) {\n var fromNullableF = fromNullable(F);\n return function (e) {\n var fromNullableFE = fromNullableF(e);\n return function (f) { return flow(f, fromNullableFE); };\n };\n}\nexport function chainNullableK(M) {\n var chainM = chain(M);\n var fromNullableKM = fromNullableK(M);\n return function (e) {\n var fromNullableKMe = fromNullableKM(e);\n return function (f) { return chainM(fromNullableKMe(f)); };\n };\n}\nexport function map(F) {\n return map_(F, E.Functor);\n}\nexport function ap(F) {\n return ap_(F, E.Apply);\n}\nexport function chain(M) {\n var flatMapM = flatMap(M);\n return function (f) { return function (ma) { return flatMapM(ma, f); }; };\n}\n/** @internal */\nexport function flatMap(M) {\n return function (ma, f) { return M.chain(ma, function (e) { return (E.isLeft(e) ? M.of(e) : f(e.right)); }); };\n}\nexport function alt(M) {\n return function (second) { return function (first) { return M.chain(first, function (e) { return (E.isLeft(e) ? second() : M.of(e)); }); }; };\n}\nexport function bimap(F) {\n var mapBothF = mapBoth(F);\n return function (f, g) { return function (self) { return mapBothF(self, f, g); }; };\n}\n/** @internal */\nexport function mapBoth(F) {\n return function (self, f, g) { return F.map(self, E.bimap(f, g)); };\n}\nexport function mapLeft(F) {\n var mapErrorF = mapError(F);\n return function (f) { return function (self) { return mapErrorF(self, f); }; };\n}\n/** @internal */\nexport function mapError(F) {\n return function (self, f) { return F.map(self, E.mapLeft(f)); };\n}\nexport function altValidation(M, S) {\n return function (second) { return function (first) {\n return M.chain(first, E.match(function (e1) {\n return M.map(second(), E.mapLeft(function (e2) { return S.concat(e1, e2); }));\n }, right(M)));\n }; };\n}\nexport function match(F) {\n return function (onLeft, onRight) { return function (ma) { return F.map(ma, E.match(onLeft, onRight)); }; };\n}\nexport function matchE(M) {\n return function (onLeft, onRight) { return function (ma) { return M.chain(ma, E.match(onLeft, onRight)); }; };\n}\nexport function getOrElse(M) {\n return function (onLeft) { return function (ma) { return M.chain(ma, E.match(onLeft, M.of)); }; };\n}\nexport function orElse(M) {\n return function (onLeft) { return function (ma) { return M.chain(ma, function (e) { return (E.isLeft(e) ? onLeft(e.left) : M.of(e)); }); }; };\n}\nexport function orElseFirst(M) {\n var tapErrorM = tapError(M);\n return function (onLeft) { return function (ma) { return tapErrorM(ma, onLeft); }; };\n}\n/** @internal */\nexport function tapError(M) {\n var orElseM = orElse(M);\n return function (ma, onLeft) {\n return pipe(ma, orElseM(function (e) { return M.map(onLeft(e), function (eb) { return (E.isLeft(eb) ? eb : E.left(e)); }); }));\n };\n}\nexport function orLeft(M) {\n return function (onLeft) { return function (ma) {\n return M.chain(ma, E.match(function (e) { return M.map(onLeft(e), E.left); }, function (a) { return M.of(E.right(a)); }));\n }; };\n}\nexport function swap(F) {\n return function (ma) { return F.map(ma, E.swap); };\n}\nexport function toUnion(F) {\n return function (fa) { return F.map(fa, E.toUnion); };\n}\n/** @deprecated */\n/* istanbul ignore next */\nexport function getEitherM(M) {\n var _ap = ap(M);\n var _map = map(M);\n var _chain = chain(M);\n var _alt = alt(M);\n var _bimap = bimap(M);\n var _mapLeft = mapLeft(M);\n var _fold = matchE(M);\n var _getOrElse = getOrElse(M);\n var _orElse = orElse(M);\n return {\n map: function (fa, f) { return pipe(fa, _map(f)); },\n ap: function (fab, fa) { return pipe(fab, _ap(fa)); },\n of: right(M),\n chain: function (ma, f) { return pipe(ma, _chain(f)); },\n alt: function (fa, that) { return pipe(fa, _alt(that)); },\n bimap: function (fea, f, g) { return pipe(fea, _bimap(f, g)); },\n mapLeft: function (fea, f) { return pipe(fea, _mapLeft(f)); },\n fold: function (fa, onLeft, onRight) { return pipe(fa, _fold(onLeft, onRight)); },\n getOrElse: function (fa, onLeft) { return pipe(fa, _getOrElse(onLeft)); },\n orElse: function (fa, f) { return pipe(fa, _orElse(f)); },\n swap: swap(M),\n rightM: rightF(M),\n leftM: leftF(M),\n left: left(M)\n };\n}\n","import { pipe } from './function';\n// -------------------------------------------------------------------------------------\n// constructors\n// -------------------------------------------------------------------------------------\n/**\n * @category constructors\n * @since 2.0.0\n */\nexport var fromEquals = function (equals) { return ({\n equals: function (x, y) { return x === y || equals(x, y); }\n}); };\n// -------------------------------------------------------------------------------------\n// combinators\n// -------------------------------------------------------------------------------------\n/**\n * @since 2.10.0\n */\nexport var struct = function (eqs) {\n return fromEquals(function (first, second) {\n for (var key in eqs) {\n if (!eqs[key].equals(first[key], second[key])) {\n return false;\n }\n }\n return true;\n });\n};\n/**\n * Given a tuple of `Eq`s returns a `Eq` for the tuple\n *\n * @example\n * import { tuple } from 'fp-ts/Eq'\n * import * as S from 'fp-ts/string'\n * import * as N from 'fp-ts/number'\n * import * as B from 'fp-ts/boolean'\n *\n * const E = tuple(S.Eq, N.Eq, B.Eq)\n * assert.strictEqual(E.equals(['a', 1, true], ['a', 1, true]), true)\n * assert.strictEqual(E.equals(['a', 1, true], ['b', 1, true]), false)\n * assert.strictEqual(E.equals(['a', 1, true], ['a', 2, true]), false)\n * assert.strictEqual(E.equals(['a', 1, true], ['a', 1, false]), false)\n *\n * @since 2.10.0\n */\nexport var tuple = function () {\n var eqs = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n eqs[_i] = arguments[_i];\n }\n return fromEquals(function (first, second) { return eqs.every(function (E, i) { return E.equals(first[i], second[i]); }); });\n};\n/* istanbul ignore next */\nvar contramap_ = function (fa, f) { return pipe(fa, contramap(f)); };\n/**\n * A typical use case for `contramap` would be like, given some `User` type, to construct an `Eq`.\n *\n * We can do so with a function from `User -> X` where `X` is some value that we know how to compare\n * for equality (meaning we have an `Eq`)\n *\n * For example, given the following `User` type, we want to construct an `Eq` that just looks at the `key` field\n * for each user (since it's known to be unique).\n *\n * If we have a way of comparing `UUID`s for equality (`eqUUID: Eq`) and we know how to go from `User -> UUID`,\n * using `contramap` we can do this\n *\n * @example\n * import { contramap, Eq } from 'fp-ts/Eq'\n * import { pipe } from 'fp-ts/function'\n * import * as S from 'fp-ts/string'\n *\n * type UUID = string\n *\n * interface User {\n * readonly key: UUID\n * readonly firstName: string\n * readonly lastName: string\n * }\n *\n * const eqUUID: Eq = S.Eq\n *\n * const eqUserByKey: Eq = pipe(\n * eqUUID,\n * contramap((user) => user.key)\n * )\n *\n * assert.deepStrictEqual(\n * eqUserByKey.equals(\n * { key: 'k1', firstName: 'a1', lastName: 'b1' },\n * { key: 'k2', firstName: 'a1', lastName: 'b1' }\n * ),\n * false\n * )\n * assert.deepStrictEqual(\n * eqUserByKey.equals(\n * { key: 'k1', firstName: 'a1', lastName: 'b1' },\n * { key: 'k1', firstName: 'a2', lastName: 'b1' }\n * ),\n * true\n * )\n *\n * @since 2.0.0\n */\nexport var contramap = function (f) { return function (fa) {\n return fromEquals(function (x, y) { return fa.equals(f(x), f(y)); });\n}; };\n/**\n * @category type lambdas\n * @since 2.0.0\n */\nexport var URI = 'Eq';\n/**\n * @category instances\n * @since 2.5.0\n */\nexport var eqStrict = {\n equals: function (a, b) { return a === b; }\n};\nvar empty = {\n equals: function () { return true; }\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var getSemigroup = function () { return ({\n concat: function (x, y) { return fromEquals(function (a, b) { return x.equals(a, b) && y.equals(a, b); }); }\n}); };\n/**\n * @category instances\n * @since 2.6.0\n */\nexport var getMonoid = function () { return ({\n concat: getSemigroup().concat,\n empty: empty\n}); };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Contravariant = {\n URI: URI,\n contramap: contramap_\n};\n// -------------------------------------------------------------------------------------\n// deprecated\n// -------------------------------------------------------------------------------------\n/**\n * Use [`tuple`](#tuple) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getTupleEq = tuple;\n/**\n * Use [`struct`](#struct) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getStructEq = struct;\n/**\n * Use [`eqStrict`](#eqstrict) instead\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var strictEqual = eqStrict.equals;\n/**\n * This instance is deprecated, use small, specific instances instead.\n * For example if a function needs a `Contravariant` instance, pass `E.Contravariant` instead of `E.eq`\n * (where `E` is from `import E from 'fp-ts/Eq'`)\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var eq = Contravariant;\n/**\n * Use [`Eq`](./boolean.ts.html#eq) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var eqBoolean = eqStrict;\n/**\n * Use [`Eq`](./string.ts.html#eq) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var eqString = eqStrict;\n/**\n * Use [`Eq`](./number.ts.html#eq) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var eqNumber = eqStrict;\n/**\n * Use [`Eq`](./Date.ts.html#eq) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var eqDate = {\n equals: function (first, second) { return first.valueOf() === second.valueOf(); }\n};\n","/**\n * The `FromEither` type class represents those data types which support errors.\n *\n * @since 2.10.0\n */\nimport { tap } from './Chain';\nimport { flow } from './function';\nimport * as _ from './internal';\nexport function fromOption(F) {\n return function (onNone) { return function (ma) { return F.fromEither(_.isNone(ma) ? _.left(onNone()) : _.right(ma.value)); }; };\n}\nexport function fromPredicate(F) {\n return function (predicate, onFalse) {\n return function (a) {\n return F.fromEither(predicate(a) ? _.right(a) : _.left(onFalse(a)));\n };\n };\n}\nexport function fromOptionK(F) {\n var fromOptionF = fromOption(F);\n return function (onNone) {\n var from = fromOptionF(onNone);\n return function (f) { return flow(f, from); };\n };\n}\nexport function chainOptionK(F, M) {\n var fromOptionKF = fromOptionK(F);\n return function (onNone) {\n var from = fromOptionKF(onNone);\n return function (f) { return function (ma) { return M.chain(ma, from(f)); }; };\n };\n}\nexport function fromEitherK(F) {\n return function (f) { return flow(f, F.fromEither); };\n}\nexport function chainEitherK(F, M) {\n var fromEitherKF = fromEitherK(F);\n return function (f) { return function (ma) { return M.chain(ma, fromEitherKF(f)); }; };\n}\nexport function chainFirstEitherK(F, M) {\n var tapEitherM = tapEither(F, M);\n return function (f) { return function (ma) { return tapEitherM(ma, f); }; };\n}\nexport function filterOrElse(F, M) {\n return function (predicate, onFalse) {\n return function (ma) {\n return M.chain(ma, function (a) { return F.fromEither(predicate(a) ? _.right(a) : _.left(onFalse(a))); });\n };\n };\n}\n/** @internal */\nexport function tapEither(F, M) {\n var fromEither = fromEitherK(F);\n var tapM = tap(M);\n return function (self, f) { return tapM(self, fromEither(f)); };\n}\n","/**\n * Lift a computation from the `IO` monad\n *\n * @since 2.10.0\n */\nimport { tap } from './Chain';\nimport { flow } from './function';\nexport function fromIOK(F) {\n return function (f) { return flow(f, F.fromIO); };\n}\nexport function chainIOK(F, M) {\n return function (f) {\n var g = flow(f, F.fromIO);\n return function (first) { return M.chain(first, g); };\n };\n}\nexport function chainFirstIOK(F, M) {\n var tapIOM = tapIO(F, M);\n return function (f) { return function (first) { return tapIOM(first, f); }; };\n}\n/** @internal */\nexport function tapIO(F, M) {\n var chainFirstM = tap(M);\n return function (self, f) { return chainFirstM(self, flow(f, F.fromIO)); };\n}\n","/**\n * Lift a computation from the `Task` monad\n *\n * @since 2.10.0\n */\nimport { tap } from './Chain';\nimport { flow } from './function';\nexport function fromTaskK(F) {\n return function (f) { return flow(f, F.fromTask); };\n}\nexport function chainTaskK(F, M) {\n return function (f) {\n var g = flow(f, F.fromTask);\n return function (first) { return M.chain(first, g); };\n };\n}\nexport function chainFirstTaskK(F, M) {\n var tapTaskM = tapTask(F, M);\n return function (f) { return function (first) { return tapTaskM(first, f); }; };\n}\n/** @internal */\nexport function tapTask(F, M) {\n var tapM = tap(M);\n return function (self, f) { return tapM(self, flow(f, F.fromTask)); };\n}\n","/**\n * A `Functor` is a type constructor which supports a mapping operation `map`.\n *\n * `map` can be used to turn functions `a -> b` into functions `f a -> f b` whose argument and return types use the type\n * constructor `f` to represent some computational context.\n *\n * Instances must satisfy the following laws:\n *\n * 1. Identity: `F.map(fa, a => a) <-> fa`\n * 2. Composition: `F.map(fa, a => bc(ab(a))) <-> F.map(F.map(fa, ab), bc)`\n *\n * @since 2.0.0\n */\nimport { pipe } from './function';\nexport function map(F, G) {\n return function (f) { return function (fa) { return F.map(fa, function (ga) { return G.map(ga, f); }); }; };\n}\nexport function flap(F) {\n return function (a) { return function (fab) { return F.map(fab, function (f) { return f(a); }); }; };\n}\nexport function bindTo(F) {\n return function (name) { return function (fa) { return F.map(fa, function (a) {\n var _a;\n return (_a = {}, _a[name] = a, _a);\n }); }; };\n}\nfunction let_(F) {\n return function (name, f) { return function (fa) { return F.map(fa, function (a) {\n var _a;\n return Object.assign({}, a, (_a = {}, _a[name] = f(a), _a));\n }); }; };\n}\nexport { \n/**\n * @since 2.13.0\n */\nlet_ as let };\n/** @deprecated */\nexport function getFunctorComposition(F, G) {\n var _map = map(F, G);\n return {\n map: function (fga, f) { return pipe(fga, _map(f)); }\n };\n}\n/** @internal */\nexport function as(F) {\n return function (self, b) { return F.map(self, function () { return b; }); };\n}\n/** @internal */\nexport function asUnit(F) {\n var asM = as(F);\n return function (self) { return asM(self, undefined); };\n}\n"],"names":["getApplicativeMonoid","F","f","getApplySemigroup","M","concat","empty","of","ap","G","fa","fab","map","gab","ga","apFirst","A","second","first","a","apSecond","b","apS","name","fb","_a","Object","assign","S","x","y","append","NEA","isOutOfBound","takeLeft","RA","n","as","copy","slice","dropLeft","length","isEmpty","_map","pipe","_reduce","reduce","_foldMap","foldMapM","foldMap","_reduceRight","reduceRight","_traverse","traverseF","traverse","ta","flatMap","dual","ma","out","i","push","apply","chainWithIndex","mapWithIndex","filterMapWithIndex","optionB","_","value","filterMap","compact","identity","separate","left","right","_i","fa_1","e","_tag","separated","filter","predicate","partition","partitionWithIndex","predicateWithIndex","partitionMap","partitionMapWithIndex","alt","that","filterWithIndex","extend","wa","foldMapWithIndex","reduceWithIndex","reduceRightWithIndex","traverseWithIndexF","traverseWithIndex","sequence","fas","fbs","bs","URI","Compactable","Traversable","_wither","witherDefault","_wilt","wiltDefault","snoc","array","chain","zero","unfold","bb","mt","b_1","foldMapWithIndexM","wither","wilt","tap","bind","tailRec","startWith","ab","isLeft","_ap","_bimap","g","bimap","_mapLeft","mapLeft","_alt","_extend","_chainRec","getShow","SE","SA","show","getEq","EL","EA","equals","isRight","getSemigroup","getCompactable","_E","undefined","getFilterable","ob","p","getWitherable","F_","C","getApplicativeValidation","getAltValidation","me","ea","Functor","as_","asUnit","asUnit_","Pointed","apW","Apply","Applicative","Chain","Monad","Foldable","Bifunctor","altW","Alt","Extend","ChainRec","chainRec","throwError","MonadThrow","FromEither","fromEither","fromPredicate","fromPredicate_","fromOption","fromOption_","matchW","onLeft","onRight","foldW","match","fold","getOrElseW","getOrElse","flap","flap_","apFirst_","apFirstW","apSecond_","apSecondW","chainable","flattenW","flatten","duplicate","fromOptionK","fromOptionK_","chainOptionK","chainOptionK_","chainOptionKW","_FromEither","liftNullable","liftOption","_FlatMap","flatMapNullable","flatMapOption","filterOrElse","filterOrElse_","filterOrElseW","swap","orElseW","orElse","fromNullable","tryCatch","onThrow","tryCatchK","arguments","fromNullableK","from","flow","chainNullableK","toUnion","toError","Error","String","elem","E","elemE_1","exists","Do","bindTo","bindTo_","let_","let__","bindW","apS_","apSW","ApT","traverseReadonlyNonEmptyArrayWithIndex","e_1","traverseReadonlyArrayWithIndex","traverseArrayWithIndex","traverseArray","sequenceArray","chainW","chainFirst","chainFirstW","parseJSON","s","onError","JSON","parse","stringifyJSON","u","stringify","either","getApplySemigroup_","getApplyMonoid","getValidationSemigroup","getValidationMonoid","MA","getValidation","rightF","leftF","fe","fromNullableF","fromNullableFE","chainM","flatMapM","fromNullableKM","fromNullableKMe","map_","ap_","mapBoth","self","mapError","matchE","tapError","orElseM","eb","orLeft","fromEquals","eqStrict","onNone","onFalse","fromOptionF","fromOptionKF","tapEither","fromEitherK","tapM","tapIO","chainFirstM","fromIO","tapTask","fromTask","asM"],"sourceRoot":""}