@nlozgachev/pipelined 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/LICENCE +28 -0
  2. package/README.md +1 -1
  3. package/{types/src/Types/NonEmptyList.d.ts → dist/NonEmptyList-BlGFjor5.d.mts} +4 -3
  4. package/dist/NonEmptyList-BlGFjor5.d.ts +30 -0
  5. package/dist/Task-BB8Wmc1J.d.ts +677 -0
  6. package/dist/Task-ChKyH0pF.d.mts +677 -0
  7. package/dist/chunk-DBIC62UV.mjs +6 -0
  8. package/dist/chunk-QPTGO5AS.mjs +150 -0
  9. package/dist/composition.d.mts +495 -0
  10. package/dist/composition.d.ts +495 -0
  11. package/dist/composition.js +188 -0
  12. package/dist/composition.mjs +135 -0
  13. package/dist/core.d.mts +2170 -0
  14. package/dist/core.d.ts +2170 -0
  15. package/dist/core.js +698 -0
  16. package/dist/core.mjs +517 -0
  17. package/dist/types.d.mts +54 -0
  18. package/{types/src/Types/Brand.d.ts → dist/types.d.ts} +6 -4
  19. package/dist/types.js +41 -0
  20. package/dist/types.mjs +14 -0
  21. package/dist/utils.d.mts +1285 -0
  22. package/dist/utils.d.ts +1285 -0
  23. package/dist/utils.js +722 -0
  24. package/dist/utils.mjs +553 -0
  25. package/package.json +63 -69
  26. package/esm/mod.js +0 -3
  27. package/esm/package.json +0 -3
  28. package/esm/src/Composition/compose.js +0 -3
  29. package/esm/src/Composition/converge.js +0 -3
  30. package/esm/src/Composition/curry.js +0 -42
  31. package/esm/src/Composition/flip.js +0 -20
  32. package/esm/src/Composition/flow.js +0 -8
  33. package/esm/src/Composition/fn.js +0 -85
  34. package/esm/src/Composition/index.js +0 -13
  35. package/esm/src/Composition/juxt.js +0 -3
  36. package/esm/src/Composition/memoize.js +0 -66
  37. package/esm/src/Composition/not.js +0 -25
  38. package/esm/src/Composition/on.js +0 -12
  39. package/esm/src/Composition/pipe.js +0 -3
  40. package/esm/src/Composition/tap.js +0 -33
  41. package/esm/src/Composition/uncurry.js +0 -32
  42. package/esm/src/Core/Deferred.js +0 -30
  43. package/esm/src/Core/InternalTypes.js +0 -1
  44. package/esm/src/Core/Lens.js +0 -98
  45. package/esm/src/Core/Logged.js +0 -111
  46. package/esm/src/Core/Option.js +0 -191
  47. package/esm/src/Core/Optional.js +0 -160
  48. package/esm/src/Core/Predicate.js +0 -133
  49. package/esm/src/Core/Reader.js +0 -134
  50. package/esm/src/Core/Refinement.js +0 -115
  51. package/esm/src/Core/RemoteData.js +0 -211
  52. package/esm/src/Core/Result.js +0 -170
  53. package/esm/src/Core/State.js +0 -181
  54. package/esm/src/Core/Task.js +0 -223
  55. package/esm/src/Core/TaskOption.js +0 -106
  56. package/esm/src/Core/TaskResult.js +0 -127
  57. package/esm/src/Core/TaskValidation.js +0 -128
  58. package/esm/src/Core/These.js +0 -245
  59. package/esm/src/Core/Tuple.js +0 -112
  60. package/esm/src/Core/Validation.js +0 -212
  61. package/esm/src/Core/index.js +0 -18
  62. package/esm/src/Types/Brand.js +0 -28
  63. package/esm/src/Types/NonEmptyList.js +0 -14
  64. package/esm/src/Types/index.js +0 -2
  65. package/esm/src/Utils/Arr.js +0 -570
  66. package/esm/src/Utils/Dict.js +0 -421
  67. package/esm/src/Utils/Num.js +0 -124
  68. package/esm/src/Utils/Rec.js +0 -241
  69. package/esm/src/Utils/Str.js +0 -134
  70. package/esm/src/Utils/Uniq.js +0 -265
  71. package/esm/src/Utils/index.js +0 -6
  72. package/script/mod.js +0 -19
  73. package/script/package.json +0 -3
  74. package/script/src/Composition/compose.js +0 -6
  75. package/script/src/Composition/converge.js +0 -6
  76. package/script/src/Composition/curry.js +0 -48
  77. package/script/src/Composition/flip.js +0 -24
  78. package/script/src/Composition/flow.js +0 -11
  79. package/script/src/Composition/fn.js +0 -98
  80. package/script/src/Composition/index.js +0 -29
  81. package/script/src/Composition/juxt.js +0 -6
  82. package/script/src/Composition/memoize.js +0 -71
  83. package/script/src/Composition/not.js +0 -29
  84. package/script/src/Composition/on.js +0 -16
  85. package/script/src/Composition/pipe.js +0 -6
  86. package/script/src/Composition/tap.js +0 -37
  87. package/script/src/Composition/uncurry.js +0 -38
  88. package/script/src/Core/Deferred.js +0 -33
  89. package/script/src/Core/InternalTypes.js +0 -2
  90. package/script/src/Core/Lens.js +0 -101
  91. package/script/src/Core/Logged.js +0 -114
  92. package/script/src/Core/Option.js +0 -194
  93. package/script/src/Core/Optional.js +0 -163
  94. package/script/src/Core/Predicate.js +0 -136
  95. package/script/src/Core/Reader.js +0 -137
  96. package/script/src/Core/Refinement.js +0 -118
  97. package/script/src/Core/RemoteData.js +0 -214
  98. package/script/src/Core/Result.js +0 -173
  99. package/script/src/Core/State.js +0 -184
  100. package/script/src/Core/Task.js +0 -226
  101. package/script/src/Core/TaskOption.js +0 -109
  102. package/script/src/Core/TaskResult.js +0 -130
  103. package/script/src/Core/TaskValidation.js +0 -131
  104. package/script/src/Core/These.js +0 -248
  105. package/script/src/Core/Tuple.js +0 -115
  106. package/script/src/Core/Validation.js +0 -215
  107. package/script/src/Core/index.js +0 -34
  108. package/script/src/Types/Brand.js +0 -31
  109. package/script/src/Types/NonEmptyList.js +0 -18
  110. package/script/src/Types/index.js +0 -18
  111. package/script/src/Utils/Arr.js +0 -573
  112. package/script/src/Utils/Dict.js +0 -424
  113. package/script/src/Utils/Num.js +0 -127
  114. package/script/src/Utils/Rec.js +0 -244
  115. package/script/src/Utils/Str.js +0 -137
  116. package/script/src/Utils/Uniq.js +0 -268
  117. package/script/src/Utils/index.js +0 -22
  118. package/types/mod.d.ts +0 -4
  119. package/types/mod.d.ts.map +0 -1
  120. package/types/src/Composition/compose.d.ts +0 -33
  121. package/types/src/Composition/compose.d.ts.map +0 -1
  122. package/types/src/Composition/converge.d.ts +0 -21
  123. package/types/src/Composition/converge.d.ts.map +0 -1
  124. package/types/src/Composition/curry.d.ts +0 -43
  125. package/types/src/Composition/curry.d.ts.map +0 -1
  126. package/types/src/Composition/flip.d.ts +0 -21
  127. package/types/src/Composition/flip.d.ts.map +0 -1
  128. package/types/src/Composition/flow.d.ts +0 -56
  129. package/types/src/Composition/flow.d.ts.map +0 -1
  130. package/types/src/Composition/fn.d.ts +0 -76
  131. package/types/src/Composition/fn.d.ts.map +0 -1
  132. package/types/src/Composition/index.d.ts +0 -14
  133. package/types/src/Composition/index.d.ts.map +0 -1
  134. package/types/src/Composition/juxt.d.ts +0 -18
  135. package/types/src/Composition/juxt.d.ts.map +0 -1
  136. package/types/src/Composition/memoize.d.ts +0 -46
  137. package/types/src/Composition/memoize.d.ts.map +0 -1
  138. package/types/src/Composition/not.d.ts +0 -26
  139. package/types/src/Composition/not.d.ts.map +0 -1
  140. package/types/src/Composition/on.d.ts +0 -13
  141. package/types/src/Composition/on.d.ts.map +0 -1
  142. package/types/src/Composition/pipe.d.ts +0 -56
  143. package/types/src/Composition/pipe.d.ts.map +0 -1
  144. package/types/src/Composition/tap.d.ts +0 -31
  145. package/types/src/Composition/tap.d.ts.map +0 -1
  146. package/types/src/Composition/uncurry.d.ts +0 -54
  147. package/types/src/Composition/uncurry.d.ts.map +0 -1
  148. package/types/src/Core/Deferred.d.ts +0 -49
  149. package/types/src/Core/Deferred.d.ts.map +0 -1
  150. package/types/src/Core/InternalTypes.d.ts +0 -23
  151. package/types/src/Core/InternalTypes.d.ts.map +0 -1
  152. package/types/src/Core/Lens.d.ts +0 -118
  153. package/types/src/Core/Lens.d.ts.map +0 -1
  154. package/types/src/Core/Logged.d.ts +0 -126
  155. package/types/src/Core/Logged.d.ts.map +0 -1
  156. package/types/src/Core/Option.d.ts +0 -209
  157. package/types/src/Core/Option.d.ts.map +0 -1
  158. package/types/src/Core/Optional.d.ts +0 -158
  159. package/types/src/Core/Optional.d.ts.map +0 -1
  160. package/types/src/Core/Predicate.d.ts +0 -161
  161. package/types/src/Core/Predicate.d.ts.map +0 -1
  162. package/types/src/Core/Reader.d.ts +0 -156
  163. package/types/src/Core/Reader.d.ts.map +0 -1
  164. package/types/src/Core/Refinement.d.ts +0 -138
  165. package/types/src/Core/Refinement.d.ts.map +0 -1
  166. package/types/src/Core/RemoteData.d.ts +0 -197
  167. package/types/src/Core/RemoteData.d.ts.map +0 -1
  168. package/types/src/Core/Result.d.ts +0 -182
  169. package/types/src/Core/Result.d.ts.map +0 -1
  170. package/types/src/Core/State.d.ts +0 -192
  171. package/types/src/Core/State.d.ts.map +0 -1
  172. package/types/src/Core/Task.d.ts +0 -219
  173. package/types/src/Core/Task.d.ts.map +0 -1
  174. package/types/src/Core/TaskOption.d.ts +0 -121
  175. package/types/src/Core/TaskOption.d.ts.map +0 -1
  176. package/types/src/Core/TaskResult.d.ts +0 -119
  177. package/types/src/Core/TaskResult.d.ts.map +0 -1
  178. package/types/src/Core/TaskValidation.d.ts +0 -144
  179. package/types/src/Core/TaskValidation.d.ts.map +0 -1
  180. package/types/src/Core/These.d.ts +0 -225
  181. package/types/src/Core/These.d.ts.map +0 -1
  182. package/types/src/Core/Tuple.d.ts +0 -129
  183. package/types/src/Core/Tuple.d.ts.map +0 -1
  184. package/types/src/Core/Validation.d.ts +0 -203
  185. package/types/src/Core/Validation.d.ts.map +0 -1
  186. package/types/src/Core/index.d.ts +0 -19
  187. package/types/src/Core/index.d.ts.map +0 -1
  188. package/types/src/Types/Brand.d.ts.map +0 -1
  189. package/types/src/Types/NonEmptyList.d.ts.map +0 -1
  190. package/types/src/Types/index.d.ts +0 -3
  191. package/types/src/Types/index.d.ts.map +0 -1
  192. package/types/src/Utils/Arr.d.ts +0 -403
  193. package/types/src/Utils/Arr.d.ts.map +0 -1
  194. package/types/src/Utils/Dict.d.ts +0 -310
  195. package/types/src/Utils/Dict.d.ts.map +0 -1
  196. package/types/src/Utils/Num.d.ts +0 -110
  197. package/types/src/Utils/Num.d.ts.map +0 -1
  198. package/types/src/Utils/Rec.d.ts +0 -159
  199. package/types/src/Utils/Rec.d.ts.map +0 -1
  200. package/types/src/Utils/Str.d.ts +0 -128
  201. package/types/src/Utils/Str.d.ts.map +0 -1
  202. package/types/src/Utils/Uniq.d.ts +0 -179
  203. package/types/src/Utils/Uniq.d.ts.map +0 -1
  204. package/types/src/Utils/index.d.ts +0 -7
  205. package/types/src/Utils/index.d.ts.map +0 -1
@@ -0,0 +1,150 @@
1
+ // src/Core/Deferred.ts
2
+ var _store = /* @__PURE__ */ new WeakMap();
3
+ var Deferred;
4
+ ((Deferred2) => {
5
+ Deferred2.fromPromise = (p) => {
6
+ const d = { then: ((f) => p.then(f)) };
7
+ _store.set(d, p);
8
+ return d;
9
+ };
10
+ Deferred2.toPromise = (d) => _store.get(d) ?? new Promise((resolve) => d.then(resolve));
11
+ })(Deferred || (Deferred = {}));
12
+
13
+ // src/Core/Option.ts
14
+ var _none = { kind: "None" };
15
+ var Option;
16
+ ((Option2) => {
17
+ Option2.some = (value) => ({ kind: "Some", value });
18
+ Option2.isSome = (data) => data.kind === "Some";
19
+ Option2.none = () => _none;
20
+ Option2.isNone = (data) => data.kind === "None";
21
+ Option2.fromNullable = (value) => value === null || value === void 0 ? (0, Option2.none)() : (0, Option2.some)(value);
22
+ Option2.toNullable = (data) => (0, Option2.isSome)(data) ? data.value : null;
23
+ Option2.toUndefined = (data) => (0, Option2.isSome)(data) ? data.value : void 0;
24
+ Option2.fromUndefined = (value) => value === void 0 ? (0, Option2.none)() : (0, Option2.some)(value);
25
+ Option2.toResult = (onNone) => (data) => (0, Option2.isSome)(data) ? Result.ok(data.value) : Result.err(onNone());
26
+ Option2.fromResult = (data) => Result.isOk(data) ? (0, Option2.some)(data.value) : (0, Option2.none)();
27
+ Option2.map = (f) => (data) => (0, Option2.isSome)(data) ? (0, Option2.some)(f(data.value)) : data;
28
+ Option2.chain = (f) => (data) => (0, Option2.isSome)(data) ? f(data.value) : data;
29
+ Option2.fold = (onNone, onSome) => (data) => (0, Option2.isSome)(data) ? onSome(data.value) : onNone();
30
+ Option2.match = (cases) => (data) => (0, Option2.isSome)(data) ? cases.some(data.value) : cases.none();
31
+ Option2.getOrElse = (defaultValue) => (data) => (0, Option2.isSome)(data) ? data.value : defaultValue();
32
+ Option2.tap = (f) => (data) => {
33
+ if ((0, Option2.isSome)(data)) f(data.value);
34
+ return data;
35
+ };
36
+ Option2.filter = (predicate) => (data) => (0, Option2.isSome)(data) ? predicate(data.value) ? data : (0, Option2.none)() : data;
37
+ Option2.recover = (fallback) => (data) => (0, Option2.isSome)(data) ? data : fallback();
38
+ Option2.ap = (arg) => (data) => (0, Option2.isSome)(data) && (0, Option2.isSome)(arg) ? (0, Option2.some)(data.value(arg.value)) : (0, Option2.none)();
39
+ })(Option || (Option = {}));
40
+
41
+ // src/Core/Result.ts
42
+ var Result;
43
+ ((Result2) => {
44
+ Result2.ok = (value) => ({ kind: "Ok", value });
45
+ Result2.err = (error) => ({ kind: "Error", error });
46
+ Result2.isOk = (data) => data.kind === "Ok";
47
+ Result2.isErr = (data) => data.kind === "Error";
48
+ Result2.tryCatch = (f, onError) => {
49
+ try {
50
+ return (0, Result2.ok)(f());
51
+ } catch (e) {
52
+ return (0, Result2.err)(onError(e));
53
+ }
54
+ };
55
+ Result2.map = (f) => (data) => (0, Result2.isOk)(data) ? (0, Result2.ok)(f(data.value)) : data;
56
+ Result2.mapError = (f) => (data) => (0, Result2.isErr)(data) ? (0, Result2.err)(f(data.error)) : data;
57
+ Result2.chain = (f) => (data) => (0, Result2.isOk)(data) ? f(data.value) : data;
58
+ Result2.fold = (onErr, onOk) => (data) => (0, Result2.isOk)(data) ? onOk(data.value) : onErr(data.error);
59
+ Result2.match = (cases) => (data) => (0, Result2.isOk)(data) ? cases.ok(data.value) : cases.err(data.error);
60
+ Result2.getOrElse = (defaultValue) => (data) => (0, Result2.isOk)(data) ? data.value : defaultValue();
61
+ Result2.tap = (f) => (data) => {
62
+ if ((0, Result2.isOk)(data)) f(data.value);
63
+ return data;
64
+ };
65
+ Result2.recover = (fallback) => (data) => (0, Result2.isOk)(data) ? data : fallback(data.error);
66
+ Result2.recoverUnless = (blockedErr, fallback) => (data) => (0, Result2.isErr)(data) && data.error !== blockedErr ? fallback() : data;
67
+ Result2.toOption = (data) => (0, Result2.isOk)(data) ? Option.some(data.value) : Option.none();
68
+ Result2.ap = (arg) => (data) => (0, Result2.isOk)(data) && (0, Result2.isOk)(arg) ? (0, Result2.ok)(data.value(arg.value)) : (0, Result2.isErr)(data) ? data : arg;
69
+ })(Result || (Result = {}));
70
+
71
+ // src/Core/Task.ts
72
+ var toPromise = (task) => Deferred.toPromise(task());
73
+ var Task;
74
+ ((Task2) => {
75
+ Task2.resolve = (value) => () => Deferred.fromPromise(Promise.resolve(value));
76
+ Task2.from = (f) => () => Deferred.fromPromise(f());
77
+ Task2.map = (f) => (data) => (0, Task2.from)(() => toPromise(data).then(f));
78
+ Task2.chain = (f) => (data) => (0, Task2.from)(() => toPromise(data).then((a) => toPromise(f(a))));
79
+ Task2.ap = (arg) => (data) => (0, Task2.from)(
80
+ () => Promise.all([
81
+ toPromise(data),
82
+ toPromise(arg)
83
+ ]).then(([f, a]) => f(a))
84
+ );
85
+ Task2.tap = (f) => (data) => (0, Task2.from)(
86
+ () => toPromise(data).then((a) => {
87
+ f(a);
88
+ return a;
89
+ })
90
+ );
91
+ Task2.all = (tasks) => (0, Task2.from)(
92
+ () => Promise.all(tasks.map((t) => toPromise(t)))
93
+ );
94
+ Task2.delay = (ms) => (data) => (0, Task2.from)(
95
+ () => new Promise(
96
+ (resolve2) => setTimeout(
97
+ () => toPromise(data).then(resolve2),
98
+ ms
99
+ )
100
+ )
101
+ );
102
+ Task2.repeat = (options) => (task) => (0, Task2.from)(() => {
103
+ const { times, delay: ms } = options;
104
+ if (times <= 0) return Promise.resolve([]);
105
+ const results = [];
106
+ const wait = () => ms !== void 0 && ms > 0 ? new Promise((r) => setTimeout(r, ms)) : Promise.resolve();
107
+ const run = (left) => toPromise(task).then((a) => {
108
+ results.push(a);
109
+ if (left <= 1) return results;
110
+ return wait().then(() => run(left - 1));
111
+ });
112
+ return run(times);
113
+ });
114
+ Task2.repeatUntil = (options) => (task) => (0, Task2.from)(() => {
115
+ const { when: predicate, delay: ms } = options;
116
+ const wait = () => ms !== void 0 && ms > 0 ? new Promise((r) => setTimeout(r, ms)) : Promise.resolve();
117
+ const run = () => toPromise(task).then((a) => {
118
+ if (predicate(a)) return a;
119
+ return wait().then(run);
120
+ });
121
+ return run();
122
+ });
123
+ Task2.race = (tasks) => (0, Task2.from)(() => Promise.race(tasks.map(toPromise)));
124
+ Task2.sequential = (tasks) => (0, Task2.from)(async () => {
125
+ const results = [];
126
+ for (const task of tasks) {
127
+ results.push(await toPromise(task));
128
+ }
129
+ return results;
130
+ });
131
+ Task2.timeout = (ms, onTimeout) => (task) => (0, Task2.from)(() => {
132
+ let timerId;
133
+ return Promise.race([
134
+ toPromise(task).then((a) => {
135
+ clearTimeout(timerId);
136
+ return Result.ok(a);
137
+ }),
138
+ new Promise((resolve2) => {
139
+ timerId = setTimeout(() => resolve2(Result.err(onTimeout())), ms);
140
+ })
141
+ ]);
142
+ });
143
+ })(Task || (Task = {}));
144
+
145
+ export {
146
+ Deferred,
147
+ Result,
148
+ Option,
149
+ Task
150
+ };
@@ -0,0 +1,495 @@
1
+ /**
2
+ * Composes functions from right to left, returning a new function.
3
+ * This is the traditional mathematical function composition: (f . g)(x) = f(g(x))
4
+ *
5
+ * Unlike `flow` which reads left-to-right, `compose` reads right-to-left,
6
+ * matching how nested function calls would be written.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const addOne = (n: number) => n + 1;
11
+ * const double = (n: number) => n * 2;
12
+ *
13
+ * // compose: right-to-left (double first, then addOne)
14
+ * const composed = compose(addOne, double);
15
+ * composed(5); // 11 (5 * 2 + 1)
16
+ *
17
+ * // flow: left-to-right (addOne first, then double)
18
+ * const flowed = flow(addOne, double);
19
+ * flowed(5); // 12 ((5 + 1) * 2)
20
+ * ```
21
+ *
22
+ * @see {@link flow} for left-to-right composition
23
+ */
24
+ declare function compose<A, B>(ab: (a: A) => B): (a: A) => B;
25
+ declare function compose<A, B, C>(bc: (b: B) => C, ab: (a: A) => B): (a: A) => C;
26
+ declare function compose<A, B, C, D>(cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => D;
27
+ declare function compose<A, B, C, D, E>(de: (d: D) => E, cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => E;
28
+ declare function compose<A, B, C, D, E, F>(ef: (e: E) => F, de: (d: D) => E, cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => F;
29
+ declare function compose<A, B, C, D, E, F, G>(fg: (f: F) => G, ef: (e: E) => F, de: (d: D) => E, cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => G;
30
+ declare function compose<A, B, C, D, E, F, G, H>(gh: (g: G) => H, fg: (f: F) => G, ef: (e: E) => F, de: (d: D) => E, cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => H;
31
+ declare function compose<A, B, C, D, E, F, G, H, I>(hi: (h: H) => I, gh: (g: G) => H, fg: (f: F) => G, ef: (e: E) => F, de: (d: D) => E, cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => I;
32
+ declare function compose<A, B, C, D, E, F, G, H, I, J>(ij: (i: I) => J, hi: (h: H) => I, gh: (g: G) => H, fg: (f: F) => G, ef: (e: E) => F, de: (d: D) => E, cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => J;
33
+
34
+ /**
35
+ * Applies an input to several transformer functions independently, then passes all results to a
36
+ * combining function.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const toNameRecord = converge(
41
+ * (trimmed: string, initials: string) => ({ trimmed, initials }),
42
+ * [
43
+ * (name: string) => name.trim(),
44
+ * (name: string) => name.split(" ").map((w) => w[0]).join(""),
45
+ * ],
46
+ * );
47
+ *
48
+ * toNameRecord(" Alice Bob "); // { trimmed: "Alice Bob", initials: "AB" }
49
+ * ```
50
+ */
51
+ declare function converge<A, B, C, R>(f: (b: B, c: C) => R, transformers: [(a: A) => B, (a: A) => C]): (a: A) => R;
52
+ declare function converge<A, B, C, D, R>(f: (b: B, c: C, d: D) => R, transformers: [(a: A) => B, (a: A) => C, (a: A) => D]): (a: A) => R;
53
+ declare function converge<A, B, C, D, E, R>(f: (b: B, c: C, d: D, e: E) => R, transformers: [(a: A) => B, (a: A) => C, (a: A) => D, (a: A) => E]): (a: A) => R;
54
+
55
+ /**
56
+ * Converts a multi-argument function into a curried function.
57
+ * The inverse of `uncurry`.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const add = (a: number, b: number) => a + b;
62
+ * const curriedAdd = curry(add);
63
+ * curriedAdd(1)(2); // 3
64
+ *
65
+ * // Partial application
66
+ * const addTen = curriedAdd(10);
67
+ * addTen(5); // 15
68
+ * ```
69
+ *
70
+ * @see {@link uncurry} for the inverse operation
71
+ * @see {@link curry3} for 3-argument functions
72
+ * @see {@link curry4} for 4-argument functions
73
+ */
74
+ declare const curry: <A, B, C>(f: (a: A, b: B) => C) => (a: A) => (b: B) => C;
75
+ /**
76
+ * Converts a 3-argument function into a curried function.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * const add3 = (a: number, b: number, c: number) => a + b + c;
81
+ * const curriedAdd3 = curry3(add3);
82
+ * curriedAdd3(1)(2)(3); // 6
83
+ * ```
84
+ */
85
+ declare const curry3: <A, B, C, D>(f: (a: A, b: B, c: C) => D) => (a: A) => (b: B) => (c: C) => D;
86
+ /**
87
+ * Converts a 4-argument function into a curried function.
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * const add4 = (a: number, b: number, c: number, d: number) => a + b + c + d;
92
+ * const curriedAdd4 = curry4(add4);
93
+ * curriedAdd4(1)(2)(3)(4); // 10
94
+ * ```
95
+ */
96
+ declare const curry4: <A, B, C, D, E>(f: (a: A, b: B, c: C, d: D) => E) => (a: A) => (b: B) => (c: C) => (d: D) => E;
97
+
98
+ /**
99
+ * Flips the order of arguments for a curried binary function.
100
+ * Converts a data-last function to data-first.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * // Original data-last (for pipe)
105
+ * pipe(
106
+ * Option.some(5),
107
+ * Option.map(n => n * 2)
108
+ * ); // Some(10)
109
+ *
110
+ * // Flipped to data-first
111
+ * const mapFirst = flip(Option.map);
112
+ * mapFirst(Option.some(5))(n => n * 2); // Some(10)
113
+ * ```
114
+ *
115
+ * @see {@link uncurry} for converting curried functions to multi-argument functions
116
+ */
117
+ declare const flip: <A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C;
118
+
119
+ /**
120
+ * Composes functions from left to right, returning a new function.
121
+ * Unlike `pipe`, `flow` doesn't take an initial value - it creates
122
+ * a reusable pipeline that can be called later with arguments.
123
+ *
124
+ * Use `flow` when you want to create a named, reusable transformation.
125
+ * Use `pipe` when you want to immediately transform a value.
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * // Create a reusable transformation
130
+ * const processUser = flow(
131
+ * (user: User) => user.name,
132
+ * name => name.toUpperCase(),
133
+ * name => `Hello, ${name}!`
134
+ * );
135
+ *
136
+ * processUser({ name: "Alice" }); // "Hello, ALICE!"
137
+ * processUser({ name: "Bob" }); // "Hello, BOB!"
138
+ *
139
+ * // Compare with pipe (one-time use):
140
+ * pipe(
141
+ * user,
142
+ * u => u.name,
143
+ * name => name.toUpperCase()
144
+ * );
145
+ *
146
+ * // flow creates a function, pipe applies immediately:
147
+ * const double = flow((n: number) => n * 2);
148
+ * double(5); // 10
149
+ *
150
+ * pipe(5, n => n * 2); // 10 (immediate result)
151
+ * ```
152
+ *
153
+ * @see {@link pipe} for immediate value transformation
154
+ */
155
+ declare function flow<A extends ReadonlyArray<unknown>, B>(ab: (...a: A) => B): (...a: A) => B;
156
+ declare function flow<A extends ReadonlyArray<unknown>, B, C>(ab: (...a: A) => B, bc: (b: B) => C): (...a: A) => C;
157
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...a: A) => D;
158
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E): (...a: A) => E;
159
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F): (...a: A) => F;
160
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G): (...a: A) => G;
161
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H): (...a: A) => H;
162
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I): (...a: A) => I;
163
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J): (...a: A) => J;
164
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K): (...a: A) => K;
165
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L): (...a: A) => L;
166
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M): (...a: A) => M;
167
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N): (...a: A) => N;
168
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O): (...a: A) => O;
169
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P): (...a: A) => P;
170
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q): (...a: A) => Q;
171
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R): (...a: A) => R;
172
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S): (...a: A) => S;
173
+ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S, st: (s: S) => T): (...a: A) => T;
174
+
175
+ /**
176
+ * Returns the value unchanged. The identity function.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * identity(42); // 42
181
+ * pipe(Option.some(5), Option.fold(() => 0, identity)); // 5
182
+ * ```
183
+ */
184
+ declare const identity: <A>(a: A) => A;
185
+ /**
186
+ * Creates a function that always returns the given value, ignoring its argument.
187
+ *
188
+ * @example
189
+ * ```ts
190
+ * const always42 = constant(42);
191
+ * always42(); // 42
192
+ * [1, 2, 3].map(constant("x")); // ["x", "x", "x"]
193
+ * ```
194
+ */
195
+ declare const constant: <A>(a: A) => () => A;
196
+ /** Always returns `true`. */
197
+ declare const constTrue: () => true;
198
+ /** Always returns `false`. */
199
+ declare const constFalse: () => false;
200
+ /** Always returns `null`. */
201
+ declare const constNull: () => null;
202
+ /** Always returns `undefined`. */
203
+ declare const constUndefined: () => undefined;
204
+ /** Always returns `void`. */
205
+ declare const constVoid: () => void;
206
+ /**
207
+ * Combines two predicates with logical AND.
208
+ *
209
+ * @example
210
+ * ```ts
211
+ * const isPositive = (n: number) => n > 0;
212
+ * const isEven = (n: number) => n % 2 === 0;
213
+ * const isPositiveEven = and(isPositive, isEven);
214
+ *
215
+ * isPositiveEven(4); // true
216
+ * isPositiveEven(-2); // false
217
+ * isPositiveEven(3); // false
218
+ * ```
219
+ */
220
+ declare const and: <A extends ReadonlyArray<unknown>>(p1: (...args: A) => boolean, p2: (...args: A) => boolean) => (...args: A) => boolean;
221
+ /**
222
+ * Combines two predicates with logical OR.
223
+ *
224
+ * @example
225
+ * ```ts
226
+ * const isNegative = (n: number) => n < 0;
227
+ * const isZero = (n: number) => n === 0;
228
+ * const isNonPositive = or(isNegative, isZero);
229
+ *
230
+ * isNonPositive(-1); // true
231
+ * isNonPositive(0); // true
232
+ * isNonPositive(1); // false
233
+ * ```
234
+ */
235
+ declare const or: <A extends ReadonlyArray<unknown>>(p1: (...args: A) => boolean, p2: (...args: A) => boolean) => (...args: A) => boolean;
236
+ /**
237
+ * Creates a function that executes at most once.
238
+ * Subsequent calls return the cached result from the first execution.
239
+ *
240
+ * @example
241
+ * ```ts
242
+ * let count = 0;
243
+ * const initOnce = once(() => { count++; return "initialized"; });
244
+ *
245
+ * initOnce(); // "initialized", count === 1
246
+ * initOnce(); // "initialized", count === 1 (not called again)
247
+ * ```
248
+ */
249
+ declare const once: <A>(f: () => A) => () => A;
250
+
251
+ /**
252
+ * Applies an input to an array of functions and collects the results into a tuple.
253
+ *
254
+ * @example
255
+ * ```ts
256
+ * const nameParts = juxt([
257
+ * (name: string) => name.split(" ")[0],
258
+ * (name: string) => name.split(" ").slice(1).join(" "),
259
+ * ]);
260
+ *
261
+ * nameParts("Alice Smith"); // ["Alice", "Smith"]
262
+ * ```
263
+ */
264
+ declare function juxt<A, B, C>(fns: [(a: A) => B, (a: A) => C]): (a: A) => [B, C];
265
+ declare function juxt<A, B, C, D>(fns: [(a: A) => B, (a: A) => C, (a: A) => D]): (a: A) => [B, C, D];
266
+ declare function juxt<A, B, C, D, E>(fns: [(a: A) => B, (a: A) => C, (a: A) => D, (a: A) => E]): (a: A) => [B, C, D, E];
267
+ declare function juxt<A, B>(fns: ReadonlyArray<(a: A) => B>): (a: A) => B[];
268
+
269
+ /**
270
+ * Creates a memoized version of a function that caches results.
271
+ * Subsequent calls with the same argument return the cached result.
272
+ *
273
+ * By default, uses the argument directly as the cache key.
274
+ * For complex arguments, provide a custom `keyFn` to generate cache keys.
275
+ *
276
+ * @example
277
+ * ```ts
278
+ * // Basic usage
279
+ * const expensive = memoize((n: number) => {
280
+ * console.log("Computing...");
281
+ * return n * 2;
282
+ * });
283
+ *
284
+ * expensive(5); // logs "Computing...", returns 10
285
+ * expensive(5); // returns 10 (cached, no log)
286
+ * expensive(3); // logs "Computing...", returns 6
287
+ *
288
+ * // With custom key function for objects
289
+ * const fetchUser = memoize(
290
+ * (opts: { id: string }) => fetch(`/users/${opts.id}`),
291
+ * opts => opts.id
292
+ * );
293
+ * ```
294
+ */
295
+ declare const memoize: <A, B>(f: (a: A) => B, keyFn?: (a: A) => unknown) => (a: A) => B;
296
+ /**
297
+ * Creates a memoized version of a function using WeakMap.
298
+ * Only works with object arguments, but allows garbage collection
299
+ * of cached values when keys are no longer referenced.
300
+ *
301
+ * @example
302
+ * ```ts
303
+ * const processUser = memoizeWeak((user: User) => {
304
+ * return expensiveOperation(user);
305
+ * });
306
+ *
307
+ * const user = { id: 1, name: "Alice" };
308
+ * processUser(user); // computed
309
+ * processUser(user); // cached
310
+ * // When `user` is garbage collected, cached result is too
311
+ * ```
312
+ */
313
+ declare const memoizeWeak: <A extends object, B>(f: (a: A) => B) => (a: A) => B;
314
+
315
+ /**
316
+ * Negates a predicate function.
317
+ * Returns a new predicate that returns true when the original returns false, and vice versa.
318
+ *
319
+ * @example
320
+ * ```ts
321
+ * const isEven = (n: number) => n % 2 === 0;
322
+ * const isOdd = not(isEven);
323
+ *
324
+ * isOdd(3); // true
325
+ * isOdd(4); // false
326
+ *
327
+ * // With array methods
328
+ * const numbers = [1, 2, 3, 4, 5];
329
+ * numbers.filter(not(isEven)); // [1, 3, 5]
330
+ *
331
+ * // In pipelines
332
+ * pipe(
333
+ * users,
334
+ * Array.filter(not(isAdmin)),
335
+ * Array.map(u => u.name)
336
+ * );
337
+ * ```
338
+ */
339
+ declare const not: <A extends ReadonlyArray<unknown>>(predicate: (...args: A) => boolean) => (...args: A) => boolean;
340
+
341
+ /**
342
+ * Applies a projection to both arguments of a binary function before calling it.
343
+ * Most useful for building comparators and equality checks over projected values.
344
+ *
345
+ * @example
346
+ * ```ts
347
+ * const byLength = on((a: number, b: number) => a - b, (s: string) => s.length);
348
+ *
349
+ * ["banana", "fig", "apple"].sort(byLength); // ["fig", "apple", "banana"]
350
+ * ```
351
+ */
352
+ declare const on: <A, B, C>(f: (b1: B, b2: B) => C, g: (a: A) => B) => (a: A, b: A) => C;
353
+
354
+ /**
355
+ * Pipes a value through a series of functions from left to right.
356
+ * Each function receives the output of the previous function.
357
+ *
358
+ * `pipe` is the primary way to compose operations in this library.
359
+ * It makes code read top-to-bottom, left-to-right, which is more
360
+ * intuitive for developers coming from imperative backgrounds.
361
+ *
362
+ * @example
363
+ * ```ts
364
+ * // Basic usage
365
+ * const result = pipe(
366
+ * 5,
367
+ * n => n * 2,
368
+ * n => n + 1
369
+ * ); // 11
370
+ *
371
+ * // With library functions
372
+ * const greeting = pipe(
373
+ * Option.some("Alice"),
374
+ * Option.map(name => name.toUpperCase()),
375
+ * Option.map(name => `Hello, ${name}!`),
376
+ * Option.getOrElse("Hello!")
377
+ * ); // "Hello, ALICE!"
378
+ *
379
+ * // Error handling with Result
380
+ * const result = pipe(
381
+ * Result.tryCatch(() => JSON.parse(input), e => "Invalid JSON"),
382
+ * Result.map(data => data.value),
383
+ * Result.getOrElse(null)
384
+ * );
385
+ * ```
386
+ *
387
+ * @see {@link flow} for creating reusable pipelines without an initial value
388
+ */
389
+ declare function pipe<A>(a: A): A;
390
+ declare function pipe<A, B>(a: A, ab: (a: A) => B): B;
391
+ declare function pipe<A, B, C>(a: A, ab: (a: A) => B, bc: (b: B) => C): C;
392
+ declare function pipe<A, B, C, D>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D): D;
393
+ declare function pipe<A, B, C, D, E>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E): E;
394
+ declare function pipe<A, B, C, D, E, F>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F): F;
395
+ declare function pipe<A, B, C, D, E, F, G>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G): G;
396
+ declare function pipe<A, B, C, D, E, F, G, H>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H): H;
397
+ declare function pipe<A, B, C, D, E, F, G, H, I>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I): I;
398
+ declare function pipe<A, B, C, D, E, F, G, H, I, J>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J): J;
399
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K): K;
400
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L): L;
401
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M): M;
402
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N): N;
403
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O): O;
404
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P): P;
405
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q): Q;
406
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R): R;
407
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S): S;
408
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S, st: (s: S) => T): T;
409
+
410
+ /**
411
+ * Executes a side effect function and returns the original value unchanged.
412
+ * Useful for logging, debugging, or other side effects within a pipeline.
413
+ *
414
+ * @example
415
+ * ```ts
416
+ * // Debugging a pipeline
417
+ * pipe(
418
+ * Option.some(5),
419
+ * tap(x => console.log("Before map:", x)),
420
+ * Option.map(n => n * 2),
421
+ * tap(x => console.log("After map:", x)),
422
+ * Option.getOrElse(0)
423
+ * );
424
+ * // logs: "Before map: { kind: 'Some', value: 5 }"
425
+ * // logs: "After map: { kind: 'Some', value: 10 }"
426
+ * // returns: 10
427
+ *
428
+ * // Collecting intermediate values
429
+ * const values: number[] = [];
430
+ * pipe(
431
+ * [1, 2, 3],
432
+ * arr => arr.map(n => n * 2),
433
+ * tap(arr => values.push(...arr))
434
+ * );
435
+ * ```
436
+ *
437
+ * @see {@link Option.tap} for Option-specific tap that only runs on Some
438
+ */
439
+ declare const tap: <A>(f: (a: A) => void) => (a: A) => A;
440
+
441
+ /**
442
+ * Converts a curried function into a multi-argument function.
443
+ * Useful when you want to call a curried function with all arguments at once.
444
+ *
445
+ * Handles functions with 0, 1, or 2 curried arguments.
446
+ *
447
+ * @example
448
+ * ```ts
449
+ * // Thunks: () => () => C becomes () => C
450
+ * const nested = () => () => 42;
451
+ * uncurry(nested)(); // 42
452
+ *
453
+ * // Original curried function
454
+ * Option.map(n => n * 2)(Option.some(5)); // Some(10)
455
+ *
456
+ * // Uncurried - all arguments at once
457
+ * const mapUncurried = uncurry(Option.map);
458
+ * mapUncurried(n => n * 2, Option.some(5)); // Some(10)
459
+ *
460
+ * // Combined with flip for data-first uncurried
461
+ * const mapDataFirst = uncurry(flip(Option.map));
462
+ * mapDataFirst(Option.some(5), n => n * 2); // Some(10)
463
+ * ```
464
+ *
465
+ * @see {@link flip} for reversing curried argument order
466
+ * @see {@link uncurry3} for 3-argument curried functions
467
+ * @see {@link uncurry4} for 4-argument curried functions
468
+ */
469
+ declare function uncurry<C>(f: () => () => C): () => C;
470
+ declare function uncurry<A, C>(f: (a: A) => () => C): (a: A) => C;
471
+ declare function uncurry<A, B, C>(f: (a: A) => (b: B) => C): (a: A, b: B) => C;
472
+ /**
473
+ * Converts a curried 3-argument function into a multi-argument function.
474
+ *
475
+ * @example
476
+ * ```ts
477
+ * const curriedAdd3 = (a: number) => (b: number) => (c: number) => a + b + c;
478
+ * const add3 = uncurry3(curriedAdd3);
479
+ * add3(1, 2, 3); // 6
480
+ * ```
481
+ */
482
+ declare const uncurry3: <A, B, C, D>(f: (a: A) => (b: B) => (c: C) => D) => (a: A, b: B, c: C) => D;
483
+ /**
484
+ * Converts a curried 4-argument function into a multi-argument function.
485
+ *
486
+ * @example
487
+ * ```ts
488
+ * const curriedAdd4 = (a: number) => (b: number) => (c: number) => (d: number) => a + b + c + d;
489
+ * const add4 = uncurry4(curriedAdd4);
490
+ * add4(1, 2, 3, 4); // 10
491
+ * ```
492
+ */
493
+ declare const uncurry4: <A, B, C, D, E>(f: (a: A) => (b: B) => (c: C) => (d: D) => E) => (a: A, b: B, c: C, d: D) => E;
494
+
495
+ export { and, compose, constFalse, constNull, constTrue, constUndefined, constVoid, constant, converge, curry, curry3, curry4, flip, flow, identity, juxt, memoize, memoizeWeak, not, on, once, or, pipe, tap, uncurry, uncurry3, uncurry4 };