@nunofyobiz/effect-extras 0.0.2 → 2.0.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.
- package/README.md +14 -4
- package/dist/index.d.ts +605 -536
- package/dist/index.js +148 -142
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/ArrayX/ArrayX.ts +27 -25
- package/src/WarnResult/WarnResult.ts +1265 -0
- package/src/WarnResult/index.ts +1 -0
- package/src/index.ts +1 -1
- package/src/These/These.ts +0 -1173
- package/src/These/index.ts +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,184 +2,202 @@ import { Data, Effect, Option, Equivalence, Array, Predicate, Order, DateTime, D
|
|
|
2
2
|
import * as effect_Unify from 'effect/Unify';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* A
|
|
6
|
-
*
|
|
5
|
+
* A result that may come with a success value and may come with warnings — both
|
|
6
|
+
* are optional, but never both absent.
|
|
7
7
|
*
|
|
8
|
-
* Where `Result<
|
|
9
|
-
* `
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* Where `Result<A, E>` models an exclusive choice (success _or_ failure),
|
|
9
|
+
* `WarnResult` is an "inclusive or": the success value and the warnings can each
|
|
10
|
+
* be present independently. It is a tagged enum with three constructors:
|
|
11
|
+
* `SuccessOnly` (only a `success` value), `WarningsOnly` (only `warnings`), and
|
|
12
|
+
* `SuccessWithWarnings` (both). Reach for it when an operation can succeed, warn,
|
|
13
|
+
* or do both at once — e.g. a parse that yields a value _and_ a list of warnings,
|
|
14
|
+
* or that only produces warnings.
|
|
13
15
|
*
|
|
14
16
|
* @example
|
|
15
17
|
* ```ts
|
|
16
|
-
* import {
|
|
18
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
17
19
|
*
|
|
18
|
-
* const both:
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* const both: WarnResult.WarnResult<string, number> =
|
|
21
|
+
* WarnResult.SuccessWithWarnings({
|
|
22
|
+
* warnings: "rounded down",
|
|
23
|
+
* success: 1
|
|
24
|
+
* })
|
|
22
25
|
*
|
|
23
|
-
* assert.deepStrictEqual(both._tag, "
|
|
26
|
+
* assert.deepStrictEqual(both._tag, "SuccessWithWarnings")
|
|
24
27
|
* ```
|
|
25
28
|
*
|
|
26
29
|
* @category models
|
|
27
30
|
* @since 0.0.0
|
|
28
31
|
*/
|
|
29
|
-
type
|
|
30
|
-
|
|
31
|
-
readonly
|
|
32
|
+
type WarnResult<W, A> = Data.TaggedEnum<{
|
|
33
|
+
WarningsOnly: {
|
|
34
|
+
readonly warnings: W;
|
|
32
35
|
};
|
|
33
|
-
|
|
34
|
-
readonly
|
|
36
|
+
SuccessOnly: {
|
|
37
|
+
readonly success: A;
|
|
35
38
|
};
|
|
36
|
-
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
39
|
+
SuccessWithWarnings: {
|
|
40
|
+
readonly warnings: W;
|
|
41
|
+
readonly success: A;
|
|
39
42
|
};
|
|
40
43
|
}>;
|
|
41
44
|
/**
|
|
42
|
-
* The `
|
|
43
|
-
* `
|
|
45
|
+
* The `WarningsOnly` member of `WarnResult` — a result that carries only
|
|
46
|
+
* `warnings` and no `success` value.
|
|
44
47
|
*
|
|
45
48
|
* @example
|
|
46
49
|
* ```ts
|
|
47
|
-
* import {
|
|
50
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
48
51
|
*
|
|
49
|
-
* const value:
|
|
52
|
+
* const value: WarnResult.WarningsOnly<string> = WarnResult.WarningsOnly({
|
|
53
|
+
* warnings: "skipped 2 rows"
|
|
54
|
+
* })
|
|
50
55
|
*
|
|
51
|
-
* assert.deepStrictEqual(value.
|
|
56
|
+
* assert.deepStrictEqual(value.warnings, "skipped 2 rows")
|
|
52
57
|
* ```
|
|
53
58
|
*
|
|
54
59
|
* @category models
|
|
55
60
|
* @since 0.0.0
|
|
56
61
|
*/
|
|
57
|
-
type
|
|
58
|
-
_tag: "
|
|
62
|
+
type WarningsOnly<W> = WarnResult<W, never> & {
|
|
63
|
+
_tag: "WarningsOnly";
|
|
59
64
|
};
|
|
60
65
|
/**
|
|
61
|
-
* Constructs a `
|
|
66
|
+
* Constructs a `WarningsOnly` — a `WarnResult` that carries only `warnings`.
|
|
62
67
|
*
|
|
63
68
|
* @example
|
|
64
69
|
* ```ts
|
|
65
|
-
* import {
|
|
70
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
66
71
|
*
|
|
67
|
-
* const value =
|
|
72
|
+
* const value = WarnResult.WarningsOnly({ warnings: "skipped 2 rows" })
|
|
68
73
|
*
|
|
69
|
-
* assert.deepStrictEqual(value._tag, "
|
|
70
|
-
* assert.deepStrictEqual(value.
|
|
74
|
+
* assert.deepStrictEqual(value._tag, "WarningsOnly")
|
|
75
|
+
* assert.deepStrictEqual(value.warnings, "skipped 2 rows")
|
|
71
76
|
* ```
|
|
72
77
|
*
|
|
73
78
|
* @category constructors
|
|
74
79
|
* @since 0.0.0
|
|
75
80
|
*/
|
|
76
|
-
declare const
|
|
77
|
-
readonly
|
|
81
|
+
declare const WarningsOnly: <A, B>(args: {
|
|
82
|
+
readonly warnings: A;
|
|
78
83
|
}) => {
|
|
79
|
-
readonly _tag: "
|
|
80
|
-
readonly
|
|
84
|
+
readonly _tag: "WarningsOnly";
|
|
85
|
+
readonly warnings: A;
|
|
81
86
|
};
|
|
82
87
|
/**
|
|
83
|
-
* The `
|
|
84
|
-
* `
|
|
88
|
+
* The `SuccessOnly` member of `WarnResult` — a result that carries only a
|
|
89
|
+
* `success` value and no `warnings`.
|
|
85
90
|
*
|
|
86
91
|
* @example
|
|
87
92
|
* ```ts
|
|
88
|
-
* import {
|
|
93
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
89
94
|
*
|
|
90
|
-
* const value:
|
|
95
|
+
* const value: WarnResult.SuccessOnly<number> = WarnResult.SuccessOnly({
|
|
96
|
+
* success: 1
|
|
97
|
+
* })
|
|
91
98
|
*
|
|
92
|
-
* assert.deepStrictEqual(value.
|
|
99
|
+
* assert.deepStrictEqual(value.success, 1)
|
|
93
100
|
* ```
|
|
94
101
|
*
|
|
95
102
|
* @category models
|
|
96
103
|
* @since 0.0.0
|
|
97
104
|
*/
|
|
98
|
-
type
|
|
99
|
-
_tag: "
|
|
105
|
+
type SuccessOnly<A> = WarnResult<never, A> & {
|
|
106
|
+
_tag: "SuccessOnly";
|
|
100
107
|
};
|
|
101
108
|
/**
|
|
102
|
-
* Constructs a `
|
|
109
|
+
* Constructs a `SuccessOnly` — a `WarnResult` that carries only a `success` value.
|
|
103
110
|
*
|
|
104
111
|
* @example
|
|
105
112
|
* ```ts
|
|
106
|
-
* import {
|
|
113
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
107
114
|
*
|
|
108
|
-
* const value =
|
|
115
|
+
* const value = WarnResult.SuccessOnly({ success: 1 })
|
|
109
116
|
*
|
|
110
|
-
* assert.deepStrictEqual(value._tag, "
|
|
111
|
-
* assert.deepStrictEqual(value.
|
|
117
|
+
* assert.deepStrictEqual(value._tag, "SuccessOnly")
|
|
118
|
+
* assert.deepStrictEqual(value.success, 1)
|
|
112
119
|
* ```
|
|
113
120
|
*
|
|
114
121
|
* @category constructors
|
|
115
122
|
* @since 0.0.0
|
|
116
123
|
*/
|
|
117
|
-
declare const
|
|
118
|
-
readonly
|
|
124
|
+
declare const SuccessOnly: <A, B>(args: {
|
|
125
|
+
readonly success: B;
|
|
119
126
|
}) => {
|
|
120
|
-
readonly _tag: "
|
|
121
|
-
readonly
|
|
127
|
+
readonly _tag: "SuccessOnly";
|
|
128
|
+
readonly success: B;
|
|
122
129
|
};
|
|
123
130
|
/**
|
|
124
|
-
* The `
|
|
125
|
-
* `
|
|
131
|
+
* The `SuccessWithWarnings` member of `WarnResult` — a result that carries both a
|
|
132
|
+
* `success` value and `warnings`.
|
|
126
133
|
*
|
|
127
134
|
* @example
|
|
128
135
|
* ```ts
|
|
129
|
-
* import {
|
|
136
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
130
137
|
*
|
|
131
|
-
* const value:
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
138
|
+
* const value: WarnResult.SuccessWithWarnings<string, number> =
|
|
139
|
+
* WarnResult.SuccessWithWarnings({
|
|
140
|
+
* warnings: "rounded down",
|
|
141
|
+
* success: 1
|
|
142
|
+
* })
|
|
135
143
|
*
|
|
136
|
-
* assert.deepStrictEqual(value, {
|
|
144
|
+
* assert.deepStrictEqual(value, {
|
|
145
|
+
* _tag: "SuccessWithWarnings",
|
|
146
|
+
* warnings: "rounded down",
|
|
147
|
+
* success: 1
|
|
148
|
+
* })
|
|
137
149
|
* ```
|
|
138
150
|
*
|
|
139
151
|
* @category models
|
|
140
152
|
* @since 0.0.0
|
|
141
153
|
*/
|
|
142
|
-
type
|
|
143
|
-
_tag: "
|
|
154
|
+
type SuccessWithWarnings<W, A> = WarnResult<W, A> & {
|
|
155
|
+
_tag: "SuccessWithWarnings";
|
|
144
156
|
};
|
|
145
157
|
/**
|
|
146
|
-
* Constructs a `
|
|
147
|
-
* `
|
|
158
|
+
* Constructs a `SuccessWithWarnings` — a `WarnResult` that carries both a
|
|
159
|
+
* `success` value and `warnings`.
|
|
148
160
|
*
|
|
149
161
|
* @example
|
|
150
162
|
* ```ts
|
|
151
|
-
* import {
|
|
163
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
152
164
|
*
|
|
153
|
-
* const value =
|
|
165
|
+
* const value = WarnResult.SuccessWithWarnings({
|
|
166
|
+
* warnings: "rounded down",
|
|
167
|
+
* success: 1
|
|
168
|
+
* })
|
|
154
169
|
*
|
|
155
|
-
* assert.deepStrictEqual(value._tag, "
|
|
156
|
-
* assert.deepStrictEqual(value.
|
|
157
|
-
* assert.deepStrictEqual(value.
|
|
170
|
+
* assert.deepStrictEqual(value._tag, "SuccessWithWarnings")
|
|
171
|
+
* assert.deepStrictEqual(value.warnings, "rounded down")
|
|
172
|
+
* assert.deepStrictEqual(value.success, 1)
|
|
158
173
|
* ```
|
|
159
174
|
*
|
|
160
175
|
* @category constructors
|
|
161
176
|
* @since 0.0.0
|
|
162
177
|
*/
|
|
163
|
-
declare const
|
|
164
|
-
readonly
|
|
165
|
-
readonly
|
|
178
|
+
declare const SuccessWithWarnings: <A, B>(args: {
|
|
179
|
+
readonly warnings: A;
|
|
180
|
+
readonly success: B;
|
|
166
181
|
}) => {
|
|
167
|
-
readonly _tag: "
|
|
168
|
-
readonly
|
|
169
|
-
readonly
|
|
182
|
+
readonly _tag: "SuccessWithWarnings";
|
|
183
|
+
readonly warnings: A;
|
|
184
|
+
readonly success: B;
|
|
170
185
|
};
|
|
171
186
|
/**
|
|
172
|
-
* Builds per-tag refinements for `
|
|
173
|
-
* narrows a `
|
|
174
|
-
* `"
|
|
187
|
+
* Builds per-tag refinements for `WarnResult`. `is("WarningsOnly")` is a type
|
|
188
|
+
* guard that narrows a `WarnResult` to its `WarningsOnly` member, and likewise for
|
|
189
|
+
* `"SuccessOnly"` and `"SuccessWithWarnings"`.
|
|
175
190
|
*
|
|
176
191
|
* @example
|
|
177
192
|
* ```ts
|
|
178
|
-
* import {
|
|
193
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
179
194
|
*
|
|
180
|
-
* assert.deepStrictEqual(These.is("LeftOnly")(These.LeftOnly({ left: 1 })), true)
|
|
181
195
|
* assert.deepStrictEqual(
|
|
182
|
-
*
|
|
196
|
+
* WarnResult.is("WarningsOnly")(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
197
|
+
* true
|
|
198
|
+
* )
|
|
199
|
+
* assert.deepStrictEqual(
|
|
200
|
+
* WarnResult.is("WarningsOnly")(WarnResult.SuccessOnly({ success: 1 })),
|
|
183
201
|
* false
|
|
184
202
|
* )
|
|
185
203
|
* ```
|
|
@@ -187,56 +205,56 @@ declare const LeftAndRight: <A, B>(args: {
|
|
|
187
205
|
* @category guards
|
|
188
206
|
* @since 0.0.0
|
|
189
207
|
*/
|
|
190
|
-
declare const is: <Tag extends "
|
|
208
|
+
declare const is: <Tag extends "WarningsOnly" | "SuccessOnly" | "SuccessWithWarnings">(tag: Tag) => {
|
|
191
209
|
<T extends {
|
|
192
|
-
readonly _tag: "
|
|
193
|
-
readonly
|
|
210
|
+
readonly _tag: "WarningsOnly";
|
|
211
|
+
readonly warnings: any;
|
|
194
212
|
} | {
|
|
195
|
-
readonly _tag: "
|
|
196
|
-
readonly
|
|
213
|
+
readonly _tag: "SuccessOnly";
|
|
214
|
+
readonly success: any;
|
|
197
215
|
} | {
|
|
198
|
-
readonly _tag: "
|
|
199
|
-
readonly
|
|
200
|
-
readonly
|
|
216
|
+
readonly _tag: "SuccessWithWarnings";
|
|
217
|
+
readonly warnings: any;
|
|
218
|
+
readonly success: any;
|
|
201
219
|
}>(u: T): u is T & {
|
|
202
220
|
readonly _tag: Tag;
|
|
203
221
|
};
|
|
204
222
|
(u: unknown): u is Extract<{
|
|
205
|
-
readonly _tag: "
|
|
206
|
-
readonly
|
|
223
|
+
readonly _tag: "WarningsOnly";
|
|
224
|
+
readonly warnings: unknown;
|
|
207
225
|
}, {
|
|
208
226
|
readonly _tag: Tag;
|
|
209
227
|
}> | Extract<{
|
|
210
|
-
readonly _tag: "
|
|
211
|
-
readonly
|
|
228
|
+
readonly _tag: "SuccessOnly";
|
|
229
|
+
readonly success: unknown;
|
|
212
230
|
}, {
|
|
213
231
|
readonly _tag: Tag;
|
|
214
232
|
}> | Extract<{
|
|
215
|
-
readonly _tag: "
|
|
216
|
-
readonly
|
|
217
|
-
readonly
|
|
233
|
+
readonly _tag: "SuccessWithWarnings";
|
|
234
|
+
readonly warnings: unknown;
|
|
235
|
+
readonly success: unknown;
|
|
218
236
|
}, {
|
|
219
237
|
readonly _tag: Tag;
|
|
220
238
|
}>;
|
|
221
239
|
};
|
|
222
240
|
/**
|
|
223
|
-
* Folds a `
|
|
224
|
-
* `
|
|
225
|
-
* to the handlers' common result type.
|
|
241
|
+
* Folds a `WarnResult` over its three tags. Provide a handler for `WarningsOnly`,
|
|
242
|
+
* `SuccessOnly`, and `SuccessWithWarnings` and `match` returns a function from a
|
|
243
|
+
* `WarnResult` to the handlers' common result type.
|
|
226
244
|
*
|
|
227
245
|
* @example
|
|
228
246
|
* ```ts
|
|
229
|
-
* import {
|
|
247
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
230
248
|
*
|
|
231
|
-
* const describe =
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
249
|
+
* const describe = WarnResult.match({
|
|
250
|
+
* WarningsOnly: ({ warnings }) => `warnings ${warnings}`,
|
|
251
|
+
* SuccessOnly: ({ success }) => `success ${success}`,
|
|
252
|
+
* SuccessWithWarnings: ({ warnings, success }) => `both ${warnings}/${success}`
|
|
235
253
|
* })
|
|
236
254
|
*
|
|
237
255
|
* assert.deepStrictEqual(
|
|
238
|
-
* describe(
|
|
239
|
-
* "both 1
|
|
256
|
+
* describe(WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })),
|
|
257
|
+
* "both w/1"
|
|
240
258
|
* )
|
|
241
259
|
* ```
|
|
242
260
|
*
|
|
@@ -245,178 +263,184 @@ declare const is: <Tag extends "LeftOnly" | "RightOnly" | "LeftAndRight">(tag: T
|
|
|
245
263
|
*/
|
|
246
264
|
declare const match$1: {
|
|
247
265
|
<A, B, C, D, Cases extends {
|
|
248
|
-
readonly
|
|
249
|
-
readonly _tag: "
|
|
250
|
-
readonly
|
|
266
|
+
readonly WarningsOnly: (args: {
|
|
267
|
+
readonly _tag: "WarningsOnly";
|
|
268
|
+
readonly warnings: A;
|
|
251
269
|
}) => any;
|
|
252
|
-
readonly
|
|
253
|
-
readonly _tag: "
|
|
254
|
-
readonly
|
|
270
|
+
readonly SuccessOnly: (args: {
|
|
271
|
+
readonly _tag: "SuccessOnly";
|
|
272
|
+
readonly success: B;
|
|
255
273
|
}) => any;
|
|
256
|
-
readonly
|
|
257
|
-
readonly _tag: "
|
|
258
|
-
readonly
|
|
259
|
-
readonly
|
|
274
|
+
readonly SuccessWithWarnings: (args: {
|
|
275
|
+
readonly _tag: "SuccessWithWarnings";
|
|
276
|
+
readonly warnings: A;
|
|
277
|
+
readonly success: B;
|
|
260
278
|
}) => any;
|
|
261
279
|
}>(cases: Cases): (self: {
|
|
262
|
-
readonly _tag: "
|
|
263
|
-
readonly
|
|
280
|
+
readonly _tag: "WarningsOnly";
|
|
281
|
+
readonly warnings: A;
|
|
264
282
|
} | {
|
|
265
|
-
readonly _tag: "
|
|
266
|
-
readonly
|
|
283
|
+
readonly _tag: "SuccessOnly";
|
|
284
|
+
readonly success: B;
|
|
267
285
|
} | {
|
|
268
|
-
readonly _tag: "
|
|
269
|
-
readonly
|
|
270
|
-
readonly
|
|
271
|
-
}) => effect_Unify.Unify<ReturnType<Cases["
|
|
286
|
+
readonly _tag: "SuccessWithWarnings";
|
|
287
|
+
readonly warnings: A;
|
|
288
|
+
readonly success: B;
|
|
289
|
+
}) => effect_Unify.Unify<ReturnType<Cases["WarningsOnly" | "SuccessOnly" | "SuccessWithWarnings"]>>;
|
|
272
290
|
<A, B, C, D, Cases extends {
|
|
273
|
-
readonly
|
|
274
|
-
readonly _tag: "
|
|
275
|
-
readonly
|
|
291
|
+
readonly WarningsOnly: (args: {
|
|
292
|
+
readonly _tag: "WarningsOnly";
|
|
293
|
+
readonly warnings: A;
|
|
276
294
|
}) => any;
|
|
277
|
-
readonly
|
|
278
|
-
readonly _tag: "
|
|
279
|
-
readonly
|
|
295
|
+
readonly SuccessOnly: (args: {
|
|
296
|
+
readonly _tag: "SuccessOnly";
|
|
297
|
+
readonly success: B;
|
|
280
298
|
}) => any;
|
|
281
|
-
readonly
|
|
282
|
-
readonly _tag: "
|
|
283
|
-
readonly
|
|
284
|
-
readonly
|
|
299
|
+
readonly SuccessWithWarnings: (args: {
|
|
300
|
+
readonly _tag: "SuccessWithWarnings";
|
|
301
|
+
readonly warnings: A;
|
|
302
|
+
readonly success: B;
|
|
285
303
|
}) => any;
|
|
286
304
|
}>(self: {
|
|
287
|
-
readonly _tag: "
|
|
288
|
-
readonly
|
|
305
|
+
readonly _tag: "WarningsOnly";
|
|
306
|
+
readonly warnings: A;
|
|
289
307
|
} | {
|
|
290
|
-
readonly _tag: "
|
|
291
|
-
readonly
|
|
308
|
+
readonly _tag: "SuccessOnly";
|
|
309
|
+
readonly success: B;
|
|
292
310
|
} | {
|
|
293
|
-
readonly _tag: "
|
|
294
|
-
readonly
|
|
295
|
-
readonly
|
|
296
|
-
}, cases: Cases): effect_Unify.Unify<ReturnType<Cases["
|
|
311
|
+
readonly _tag: "SuccessWithWarnings";
|
|
312
|
+
readonly warnings: A;
|
|
313
|
+
readonly success: B;
|
|
314
|
+
}, cases: Cases): effect_Unify.Unify<ReturnType<Cases["WarningsOnly" | "SuccessOnly" | "SuccessWithWarnings"]>>;
|
|
297
315
|
};
|
|
298
316
|
/**
|
|
299
|
-
* Any `
|
|
300
|
-
* `
|
|
317
|
+
* Any `WarnResult` that is guaranteed to carry `warnings` — either `WarningsOnly`
|
|
318
|
+
* or `SuccessWithWarnings`.
|
|
301
319
|
*
|
|
302
320
|
* @example
|
|
303
321
|
* ```ts
|
|
304
|
-
* import {
|
|
322
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
305
323
|
*
|
|
306
|
-
* const value:
|
|
324
|
+
* const value: WarnResult.WithWarnings<string, number> = WarnResult.WarningsOnly({
|
|
325
|
+
* warnings: "skipped 2 rows"
|
|
326
|
+
* })
|
|
307
327
|
*
|
|
308
|
-
* assert.deepStrictEqual(value.
|
|
328
|
+
* assert.deepStrictEqual(value.warnings, "skipped 2 rows")
|
|
309
329
|
* ```
|
|
310
330
|
*
|
|
311
331
|
* @category models
|
|
312
332
|
* @since 0.0.0
|
|
313
333
|
*/
|
|
314
|
-
type
|
|
334
|
+
type WithWarnings<W, A> = WarningsOnly<W> | SuccessWithWarnings<W, A>;
|
|
315
335
|
/**
|
|
316
|
-
* Builds a `
|
|
317
|
-
* is present and `
|
|
336
|
+
* Builds a `WarnResult` known to carry `warnings`, choosing `SuccessWithWarnings`
|
|
337
|
+
* when a `success` value is present and `WarningsOnly` otherwise.
|
|
318
338
|
*
|
|
319
|
-
* Use it when the `
|
|
320
|
-
* pass an absent (`null`/`undefined`) `
|
|
321
|
-
* one to get a `
|
|
322
|
-
* `
|
|
339
|
+
* Use it when the `warnings` are mandatory and the `success` value is an optional
|
|
340
|
+
* companion: pass an absent (`null`/`undefined`) `success` to get a
|
|
341
|
+
* `WarningsOnly`, or a present one to get a `SuccessWithWarnings`. The return type
|
|
342
|
+
* `WithWarnings<W, A>` reflects that `warnings` are always present.
|
|
323
343
|
*
|
|
324
344
|
* @example
|
|
325
345
|
* ```ts
|
|
326
|
-
* import {
|
|
346
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
327
347
|
*
|
|
328
348
|
* assert.deepStrictEqual(
|
|
329
|
-
*
|
|
330
|
-
*
|
|
349
|
+
* WarnResult.WithWarnings({ warnings: "w", success: 1 }),
|
|
350
|
+
* WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })
|
|
331
351
|
* )
|
|
332
352
|
*
|
|
333
353
|
* assert.deepStrictEqual(
|
|
334
|
-
*
|
|
335
|
-
*
|
|
354
|
+
* WarnResult.WithWarnings({ warnings: "w" }),
|
|
355
|
+
* WarnResult.WarningsOnly({ warnings: "w" })
|
|
336
356
|
* )
|
|
337
357
|
* ```
|
|
338
358
|
*
|
|
339
359
|
* @category constructors
|
|
340
360
|
* @since 0.0.0
|
|
341
361
|
*/
|
|
342
|
-
declare const
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
}) =>
|
|
362
|
+
declare const WithWarnings: <W, A>({ warnings, success, }: {
|
|
363
|
+
warnings: W;
|
|
364
|
+
success?: A | undefined;
|
|
365
|
+
}) => WithWarnings<W, A>;
|
|
346
366
|
/**
|
|
347
|
-
* Any `
|
|
348
|
-
* `
|
|
367
|
+
* Any `WarnResult` that is guaranteed to carry a `success` value — either
|
|
368
|
+
* `SuccessOnly` or `SuccessWithWarnings`.
|
|
349
369
|
*
|
|
350
370
|
* @example
|
|
351
371
|
* ```ts
|
|
352
|
-
* import {
|
|
372
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
353
373
|
*
|
|
354
|
-
* const value:
|
|
374
|
+
* const value: WarnResult.WithSuccess<string, number> = WarnResult.SuccessOnly({
|
|
375
|
+
* success: 1
|
|
376
|
+
* })
|
|
355
377
|
*
|
|
356
|
-
* assert.deepStrictEqual(value.
|
|
378
|
+
* assert.deepStrictEqual(value.success, 1)
|
|
357
379
|
* ```
|
|
358
380
|
*
|
|
359
381
|
* @category models
|
|
360
382
|
* @since 0.0.0
|
|
361
383
|
*/
|
|
362
|
-
type
|
|
384
|
+
type WithSuccess<W, A> = SuccessOnly<A> | SuccessWithWarnings<W, A>;
|
|
363
385
|
/**
|
|
364
|
-
* Builds a `
|
|
365
|
-
*
|
|
386
|
+
* Builds a `WarnResult` known to carry a `success` value, choosing
|
|
387
|
+
* `SuccessWithWarnings` when `warnings` are present and `SuccessOnly` otherwise.
|
|
366
388
|
*
|
|
367
|
-
* The mirror of `
|
|
368
|
-
* optional companion. Pass
|
|
369
|
-
* `
|
|
370
|
-
* `
|
|
389
|
+
* The mirror of `WithWarnings`: the `success` value is mandatory and the
|
|
390
|
+
* `warnings` are an optional companion. Pass absent (`null`/`undefined`)
|
|
391
|
+
* `warnings` to get a `SuccessOnly`, or present ones to get a
|
|
392
|
+
* `SuccessWithWarnings`. The return type `WithSuccess<W, A>` reflects that a
|
|
393
|
+
* `success` value is always present.
|
|
371
394
|
*
|
|
372
395
|
* @example
|
|
373
396
|
* ```ts
|
|
374
|
-
* import {
|
|
397
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
375
398
|
*
|
|
376
399
|
* assert.deepStrictEqual(
|
|
377
|
-
*
|
|
378
|
-
*
|
|
400
|
+
* WarnResult.WithSuccess({ warnings: "w", success: 1 }),
|
|
401
|
+
* WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })
|
|
379
402
|
* )
|
|
380
403
|
*
|
|
381
404
|
* assert.deepStrictEqual(
|
|
382
|
-
*
|
|
383
|
-
*
|
|
405
|
+
* WarnResult.WithSuccess({ success: 1 }),
|
|
406
|
+
* WarnResult.SuccessOnly({ success: 1 })
|
|
384
407
|
* )
|
|
385
408
|
* ```
|
|
386
409
|
*
|
|
387
410
|
* @category constructors
|
|
388
411
|
* @since 0.0.0
|
|
389
412
|
*/
|
|
390
|
-
declare const
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
}) =>
|
|
413
|
+
declare const WithSuccess: <W, A>({ warnings, success, }: {
|
|
414
|
+
warnings?: W | undefined;
|
|
415
|
+
success: A;
|
|
416
|
+
}) => WithSuccess<W, A>;
|
|
394
417
|
/**
|
|
395
|
-
* Builds a `
|
|
396
|
-
* an `Option` so the all-absent case is expressible.
|
|
418
|
+
* Builds a `WarnResult` from a pair of possibly-nullish inputs, wrapping the
|
|
419
|
+
* result in an `Option` so the all-absent case is expressible.
|
|
397
420
|
*
|
|
398
|
-
* Returns `Option.some(
|
|
399
|
-
* or `Option.some(
|
|
400
|
-
* when both are nullish. Use it as the total entry
|
|
401
|
-
*
|
|
421
|
+
* Returns `Option.some(SuccessWithWarnings)` when both are present,
|
|
422
|
+
* `Option.some(WarningsOnly)` or `Option.some(SuccessOnly)` when exactly one is
|
|
423
|
+
* present, and `Option.none()` when both are nullish. Use it as the total entry
|
|
424
|
+
* point for turning an optional success value and optional warnings into a
|
|
425
|
+
* `WarnResult`.
|
|
402
426
|
*
|
|
403
427
|
* @example
|
|
404
428
|
* ```ts
|
|
405
|
-
* import {
|
|
429
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
406
430
|
* import { Option } from "effect"
|
|
407
431
|
*
|
|
408
432
|
* assert.deepStrictEqual(
|
|
409
|
-
*
|
|
410
|
-
* Option.some(
|
|
433
|
+
* WarnResult.optionFromNullables({ warnings: "w", success: 1 }),
|
|
434
|
+
* Option.some(WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 }))
|
|
411
435
|
* )
|
|
412
436
|
*
|
|
413
437
|
* assert.deepStrictEqual(
|
|
414
|
-
*
|
|
415
|
-
* Option.some(
|
|
438
|
+
* WarnResult.optionFromNullables({ warnings: "w", success: null }),
|
|
439
|
+
* Option.some(WarnResult.WarningsOnly({ warnings: "w" }))
|
|
416
440
|
* )
|
|
417
441
|
*
|
|
418
442
|
* assert.deepStrictEqual(
|
|
419
|
-
*
|
|
443
|
+
* WarnResult.optionFromNullables({ warnings: null, success: undefined }),
|
|
420
444
|
* Option.none()
|
|
421
445
|
* )
|
|
422
446
|
* ```
|
|
@@ -424,13 +448,13 @@ declare const WithRight: <L, R>({ left, right, }: {
|
|
|
424
448
|
* @category constructors
|
|
425
449
|
* @since 0.0.0
|
|
426
450
|
*/
|
|
427
|
-
declare const optionFromNullables: <
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}) => Option.Option<
|
|
451
|
+
declare const optionFromNullables: <W, A>({ warnings, success, }: {
|
|
452
|
+
warnings?: W | null | undefined;
|
|
453
|
+
success?: A | null | undefined;
|
|
454
|
+
}) => Option.Option<WarnResult<W, A>>;
|
|
431
455
|
/**
|
|
432
|
-
* Builds a `
|
|
433
|
-
* `orElse` thunk when both are absent.
|
|
456
|
+
* Builds a `WarnResult` from a pair of possibly-nullish inputs, falling back to
|
|
457
|
+
* the `orElse` thunk when both are absent.
|
|
434
458
|
*
|
|
435
459
|
* The non-optional companion to `optionFromNullables`: it unwraps the same logic
|
|
436
460
|
* but resolves the all-absent case with `orElse` instead of an `Option`. The
|
|
@@ -439,215 +463,239 @@ declare const optionFromNullables: <L, R>({ left, right, }: {
|
|
|
439
463
|
*
|
|
440
464
|
* @example
|
|
441
465
|
* ```ts
|
|
442
|
-
* import {
|
|
466
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
443
467
|
*
|
|
444
468
|
* assert.deepStrictEqual(
|
|
445
|
-
*
|
|
446
|
-
*
|
|
469
|
+
* WarnResult.fromNullables({ warnings: "w", success: 1 }),
|
|
470
|
+
* WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })
|
|
447
471
|
* )
|
|
448
472
|
*
|
|
449
473
|
* // Both absent — fall back via orElse instead of throwing
|
|
450
474
|
* assert.deepStrictEqual(
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
* orElse: () =>
|
|
475
|
+
* WarnResult.fromNullables({
|
|
476
|
+
* warnings: null,
|
|
477
|
+
* success: null,
|
|
478
|
+
* orElse: () => WarnResult.WarningsOnly({ warnings: "none" })
|
|
455
479
|
* }),
|
|
456
|
-
*
|
|
480
|
+
* WarnResult.WarningsOnly({ warnings: "none" })
|
|
457
481
|
* )
|
|
458
482
|
* ```
|
|
459
483
|
*
|
|
460
484
|
* @category constructors
|
|
461
485
|
* @since 0.0.0
|
|
462
486
|
*/
|
|
463
|
-
declare const fromNullables: <
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
orElse?: () =>
|
|
467
|
-
}) =>
|
|
487
|
+
declare const fromNullables: <W, A>({ warnings, success, orElse, }: {
|
|
488
|
+
warnings?: W | null | undefined;
|
|
489
|
+
success?: A | null | undefined;
|
|
490
|
+
orElse?: () => WarnResult<W, A>;
|
|
491
|
+
}) => WarnResult<W, A>;
|
|
468
492
|
/**
|
|
469
|
-
* Folds a `
|
|
470
|
-
* handlers.
|
|
493
|
+
* Folds a `WarnResult` from the warnings' perspective, collapsing the three tags
|
|
494
|
+
* into two handlers.
|
|
471
495
|
*
|
|
472
|
-
* Both `
|
|
473
|
-
* handler; only `
|
|
474
|
-
* you care about the `
|
|
496
|
+
* Both `WarningsOnly` and `SuccessWithWarnings` carry `warnings`, so they route to
|
|
497
|
+
* the `Warnings` handler; only `SuccessOnly` lacks `warnings` and routes to
|
|
498
|
+
* `SuccessOnly`. Use it when you care about the `warnings` and treat the
|
|
499
|
+
* success-only case as the exception.
|
|
475
500
|
*
|
|
476
501
|
* @example
|
|
477
502
|
* ```ts
|
|
478
|
-
* import {
|
|
503
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
479
504
|
*
|
|
480
|
-
* const
|
|
481
|
-
*
|
|
482
|
-
*
|
|
505
|
+
* const onWarnings = WarnResult.matchWarnings({
|
|
506
|
+
* Warnings: (warnings: string) => `warnings ${warnings}`,
|
|
507
|
+
* SuccessOnly: (success: number) => `success ${success}`
|
|
483
508
|
* })
|
|
484
509
|
*
|
|
485
|
-
* assert.deepStrictEqual(onLeft(These.LeftOnly({ left: 1 })), "left 1")
|
|
486
510
|
* assert.deepStrictEqual(
|
|
487
|
-
*
|
|
488
|
-
* "
|
|
511
|
+
* onWarnings(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
512
|
+
* "warnings w"
|
|
513
|
+
* )
|
|
514
|
+
* assert.deepStrictEqual(
|
|
515
|
+
* onWarnings(WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })),
|
|
516
|
+
* "warnings w"
|
|
517
|
+
* )
|
|
518
|
+
* assert.deepStrictEqual(
|
|
519
|
+
* onWarnings(WarnResult.SuccessOnly({ success: 1 })),
|
|
520
|
+
* "success 1"
|
|
489
521
|
* )
|
|
490
|
-
* assert.deepStrictEqual(onLeft(These.RightOnly({ right: "a" })), "right a")
|
|
491
522
|
* ```
|
|
492
523
|
*
|
|
493
524
|
* @category pattern matching
|
|
494
525
|
* @since 0.0.0
|
|
495
526
|
*/
|
|
496
|
-
declare const
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}) => (
|
|
527
|
+
declare const matchWarnings: <W, A, Z>({ Warnings, SuccessOnly, }: {
|
|
528
|
+
Warnings: (warnings: W) => Z;
|
|
529
|
+
SuccessOnly: (success: A) => Z;
|
|
530
|
+
}) => (warnResult: WarnResult<W, A>) => Z;
|
|
500
531
|
/**
|
|
501
|
-
* Folds a `
|
|
502
|
-
* handlers.
|
|
532
|
+
* Folds a `WarnResult` from the success value's perspective, collapsing the three
|
|
533
|
+
* tags into two handlers.
|
|
503
534
|
*
|
|
504
|
-
* The mirror of `
|
|
505
|
-
* so they route to the `
|
|
506
|
-
*
|
|
507
|
-
*
|
|
535
|
+
* The mirror of `matchWarnings`: both `SuccessOnly` and `SuccessWithWarnings`
|
|
536
|
+
* carry a `success` value, so they route to the `Success` handler; only
|
|
537
|
+
* `WarningsOnly` lacks a `success` value and routes to `WarningsOnly`. Use it when
|
|
538
|
+
* you care about the `success` value and treat the warnings-only case as the
|
|
539
|
+
* exception.
|
|
508
540
|
*
|
|
509
541
|
* @example
|
|
510
542
|
* ```ts
|
|
511
|
-
* import {
|
|
543
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
512
544
|
*
|
|
513
|
-
* const
|
|
514
|
-
*
|
|
515
|
-
*
|
|
545
|
+
* const onSuccess = WarnResult.matchSuccess({
|
|
546
|
+
* WarningsOnly: (warnings: string) => `warnings ${warnings}`,
|
|
547
|
+
* Success: (success: number) => `success ${success}`
|
|
516
548
|
* })
|
|
517
549
|
*
|
|
518
|
-
* assert.deepStrictEqual(onRight(These.RightOnly({ right: "a" })), "right a")
|
|
519
550
|
* assert.deepStrictEqual(
|
|
520
|
-
*
|
|
521
|
-
* "
|
|
551
|
+
* onSuccess(WarnResult.SuccessOnly({ success: 1 })),
|
|
552
|
+
* "success 1"
|
|
553
|
+
* )
|
|
554
|
+
* assert.deepStrictEqual(
|
|
555
|
+
* onSuccess(WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })),
|
|
556
|
+
* "success 1"
|
|
557
|
+
* )
|
|
558
|
+
* assert.deepStrictEqual(
|
|
559
|
+
* onSuccess(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
560
|
+
* "warnings w"
|
|
522
561
|
* )
|
|
523
|
-
* assert.deepStrictEqual(onRight(These.LeftOnly({ left: 1 })), "left 1")
|
|
524
562
|
* ```
|
|
525
563
|
*
|
|
526
564
|
* @category pattern matching
|
|
527
565
|
* @since 0.0.0
|
|
528
566
|
*/
|
|
529
|
-
declare const
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
}) => (
|
|
567
|
+
declare const matchSuccess: <W, A, Z>({ WarningsOnly, Success, }: {
|
|
568
|
+
WarningsOnly: (warnings: W) => Z;
|
|
569
|
+
Success: (success: A) => Z;
|
|
570
|
+
}) => (warnResult: WarnResult<W, A>) => Z;
|
|
533
571
|
/**
|
|
534
|
-
* Completes a `
|
|
535
|
-
* is missing from the matching `orElse` thunk.
|
|
572
|
+
* Completes a `WarnResult` into a guaranteed `SuccessWithWarnings` by filling
|
|
573
|
+
* whichever side is missing from the matching `orElse` thunk.
|
|
536
574
|
*
|
|
537
|
-
* A `
|
|
538
|
-
* `
|
|
539
|
-
* normalise a partial `
|
|
540
|
-
* sides.
|
|
575
|
+
* A `SuccessWithWarnings` passes through unchanged; a `WarningsOnly` gains a
|
|
576
|
+
* `success` value from `orElseSuccess`; a `SuccessOnly` gains `warnings` from
|
|
577
|
+
* `orElseWarnings`. Use it to normalise a partial `WarnResult` into the
|
|
578
|
+
* both-present shape before reading both sides.
|
|
541
579
|
*
|
|
542
580
|
* @example
|
|
543
581
|
* ```ts
|
|
544
|
-
* import {
|
|
582
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
545
583
|
*
|
|
546
|
-
* const fill =
|
|
547
|
-
*
|
|
548
|
-
*
|
|
584
|
+
* const fill = WarnResult.orElse({
|
|
585
|
+
* orElseWarnings: () => "no warnings",
|
|
586
|
+
* orElseSuccess: () => 0
|
|
549
587
|
* })
|
|
550
588
|
*
|
|
551
589
|
* assert.deepStrictEqual(
|
|
552
|
-
* fill(
|
|
553
|
-
*
|
|
590
|
+
* fill(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
591
|
+
* WarnResult.SuccessWithWarnings({ warnings: "w", success: 0 })
|
|
554
592
|
* )
|
|
555
593
|
* assert.deepStrictEqual(
|
|
556
|
-
* fill(
|
|
557
|
-
*
|
|
594
|
+
* fill(WarnResult.SuccessOnly({ success: 1 })),
|
|
595
|
+
* WarnResult.SuccessWithWarnings({ warnings: "no warnings", success: 1 })
|
|
558
596
|
* )
|
|
559
597
|
* ```
|
|
560
598
|
*
|
|
561
599
|
* @category getters
|
|
562
600
|
* @since 0.0.0
|
|
563
601
|
*/
|
|
564
|
-
declare const orElse: <
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
}) => (<
|
|
602
|
+
declare const orElse: <W2, A2>({ orElseWarnings, orElseSuccess, }: {
|
|
603
|
+
orElseWarnings: () => W2;
|
|
604
|
+
orElseSuccess: () => A2;
|
|
605
|
+
}) => (<W, A>(warnResult: WarnResult<W, A>) => SuccessWithWarnings<W | W2, A | A2>);
|
|
568
606
|
/**
|
|
569
|
-
* Completes a `
|
|
570
|
-
* `undefined`.
|
|
607
|
+
* Completes a `WarnResult` into a `SuccessWithWarnings` whose missing side is
|
|
608
|
+
* filled with `undefined`.
|
|
571
609
|
*
|
|
572
610
|
* A specialisation of `orElse` that supplies `undefined` for whichever side is
|
|
573
|
-
* absent, so the result always exposes both `
|
|
611
|
+
* absent, so the result always exposes both `warnings` and `success` keys (each
|
|
574
612
|
* possibly `undefined`). Use it when you want to destructure both sides without
|
|
575
613
|
* branching on the tag.
|
|
576
614
|
*
|
|
577
615
|
* @example
|
|
578
616
|
* ```ts
|
|
579
|
-
* import {
|
|
617
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
580
618
|
*
|
|
581
619
|
* assert.deepStrictEqual(
|
|
582
|
-
*
|
|
583
|
-
*
|
|
620
|
+
* WarnResult.orUndefined(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
621
|
+
* WarnResult.SuccessWithWarnings({ warnings: "w", success: undefined })
|
|
584
622
|
* )
|
|
585
623
|
* assert.deepStrictEqual(
|
|
586
|
-
*
|
|
587
|
-
*
|
|
624
|
+
* WarnResult.orUndefined(WarnResult.SuccessOnly({ success: 1 })),
|
|
625
|
+
* WarnResult.SuccessWithWarnings({ warnings: undefined, success: 1 })
|
|
588
626
|
* )
|
|
589
627
|
* ```
|
|
590
628
|
*
|
|
591
629
|
* @category getters
|
|
592
630
|
* @since 0.0.0
|
|
593
631
|
*/
|
|
594
|
-
declare const orUndefined: <
|
|
595
|
-
readonly _tag: "
|
|
596
|
-
readonly
|
|
632
|
+
declare const orUndefined: <W, A>(warnResult: {
|
|
633
|
+
readonly _tag: "WarningsOnly";
|
|
634
|
+
readonly warnings: W;
|
|
597
635
|
} | {
|
|
598
|
-
readonly _tag: "
|
|
599
|
-
readonly
|
|
636
|
+
readonly _tag: "SuccessOnly";
|
|
637
|
+
readonly success: A;
|
|
600
638
|
} | {
|
|
601
|
-
readonly _tag: "
|
|
602
|
-
readonly
|
|
603
|
-
readonly
|
|
639
|
+
readonly _tag: "SuccessWithWarnings";
|
|
640
|
+
readonly warnings: W;
|
|
641
|
+
readonly success: A;
|
|
604
642
|
}) => {
|
|
605
|
-
readonly _tag: "
|
|
606
|
-
readonly
|
|
607
|
-
readonly
|
|
643
|
+
readonly _tag: "SuccessWithWarnings";
|
|
644
|
+
readonly warnings: W | undefined;
|
|
645
|
+
readonly success: A | undefined;
|
|
608
646
|
} & {
|
|
609
|
-
_tag: "
|
|
647
|
+
_tag: "SuccessWithWarnings";
|
|
610
648
|
};
|
|
611
649
|
/**
|
|
612
|
-
* Extracts the `
|
|
613
|
-
*
|
|
650
|
+
* Extracts the `warnings` of a `WarnResult`, falling back to `orElseReturn` when
|
|
651
|
+
* no `warnings` are present.
|
|
614
652
|
*
|
|
615
|
-
* `
|
|
616
|
-
* result of `orElseReturn`. Use it to read the
|
|
617
|
-
* step.
|
|
653
|
+
* `WarningsOnly` and `SuccessWithWarnings` return their `warnings`; `SuccessOnly`
|
|
654
|
+
* returns the result of `orElseReturn`. Use it to read the warnings with a default
|
|
655
|
+
* in one step.
|
|
618
656
|
*
|
|
619
657
|
* @example
|
|
620
658
|
* ```ts
|
|
621
|
-
* import {
|
|
659
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
622
660
|
*
|
|
623
|
-
* const
|
|
661
|
+
* const warningsOrNone = WarnResult.warningsOrElse(() => "no warnings")
|
|
624
662
|
*
|
|
625
|
-
* assert.deepStrictEqual(leftOrZero(These.LeftOnly({ left: 1 })), 1)
|
|
626
663
|
* assert.deepStrictEqual(
|
|
627
|
-
*
|
|
628
|
-
*
|
|
664
|
+
* warningsOrNone(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
665
|
+
* "w"
|
|
666
|
+
* )
|
|
667
|
+
* assert.deepStrictEqual(
|
|
668
|
+
* warningsOrNone(WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })),
|
|
669
|
+
* "w"
|
|
670
|
+
* )
|
|
671
|
+
* assert.deepStrictEqual(
|
|
672
|
+
* warningsOrNone(WarnResult.SuccessOnly({ success: 1 })),
|
|
673
|
+
* "no warnings"
|
|
629
674
|
* )
|
|
630
|
-
* assert.deepStrictEqual(leftOrZero(These.RightOnly({ right: "a" })), 0)
|
|
631
675
|
* ```
|
|
632
676
|
*
|
|
633
677
|
* @category getters
|
|
634
678
|
* @since 0.0.0
|
|
635
679
|
*/
|
|
636
|
-
declare const
|
|
680
|
+
declare const warningsOrElse: <Z>(orElseReturn: () => Z) => <W, A>(warnResult: WarnResult<W, A>) => W | Z;
|
|
637
681
|
/**
|
|
638
|
-
* Extracts the `
|
|
639
|
-
* present.
|
|
682
|
+
* Extracts the `warnings` of a `WarnResult`, returning `undefined` when no
|
|
683
|
+
* `warnings` are present.
|
|
640
684
|
*
|
|
641
|
-
* A specialisation of `
|
|
642
|
-
* `
|
|
685
|
+
* A specialisation of `warningsOrElse` whose fallback is `undefined`:
|
|
686
|
+
* `WarningsOnly` and `SuccessWithWarnings` yield their `warnings`, while
|
|
687
|
+
* `SuccessOnly` yields `undefined`.
|
|
643
688
|
*
|
|
644
689
|
* @example
|
|
645
690
|
* ```ts
|
|
646
|
-
* import {
|
|
691
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
647
692
|
*
|
|
648
|
-
* assert.deepStrictEqual(These.leftOrUndefined(These.LeftOnly({ left: 1 })), 1)
|
|
649
693
|
* assert.deepStrictEqual(
|
|
650
|
-
*
|
|
694
|
+
* WarnResult.warningsOrUndefined(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
695
|
+
* "w"
|
|
696
|
+
* )
|
|
697
|
+
* assert.deepStrictEqual(
|
|
698
|
+
* WarnResult.warningsOrUndefined(WarnResult.SuccessOnly({ success: 1 })),
|
|
651
699
|
* undefined
|
|
652
700
|
* )
|
|
653
701
|
* ```
|
|
@@ -655,61 +703,62 @@ declare const leftOrElse: <A>(orElseReturn: () => A) => <L, R>(these: These<L, R
|
|
|
655
703
|
* @category getters
|
|
656
704
|
* @since 0.0.0
|
|
657
705
|
*/
|
|
658
|
-
declare const
|
|
659
|
-
readonly _tag: "
|
|
660
|
-
readonly
|
|
706
|
+
declare const warningsOrUndefined: <W, A>(warnResult: {
|
|
707
|
+
readonly _tag: "WarningsOnly";
|
|
708
|
+
readonly warnings: W;
|
|
661
709
|
} | {
|
|
662
|
-
readonly _tag: "
|
|
663
|
-
readonly
|
|
710
|
+
readonly _tag: "SuccessOnly";
|
|
711
|
+
readonly success: A;
|
|
664
712
|
} | {
|
|
665
|
-
readonly _tag: "
|
|
666
|
-
readonly
|
|
667
|
-
readonly
|
|
668
|
-
}) =>
|
|
713
|
+
readonly _tag: "SuccessWithWarnings";
|
|
714
|
+
readonly warnings: W;
|
|
715
|
+
readonly success: A;
|
|
716
|
+
}) => W | undefined;
|
|
669
717
|
/**
|
|
670
|
-
* Extracts the `
|
|
671
|
-
* `
|
|
718
|
+
* Extracts the `success` value of a `WarnResult`, falling back to `orElseReturn`
|
|
719
|
+
* when no `success` value is present.
|
|
672
720
|
*
|
|
673
|
-
* The mirror of `
|
|
674
|
-
* `
|
|
721
|
+
* The mirror of `warningsOrElse`: `SuccessOnly` and `SuccessWithWarnings` return
|
|
722
|
+
* their `success` value; `WarningsOnly` returns the result of `orElseReturn`.
|
|
675
723
|
*
|
|
676
724
|
* @example
|
|
677
725
|
* ```ts
|
|
678
|
-
* import {
|
|
726
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
679
727
|
*
|
|
680
|
-
* const
|
|
728
|
+
* const successOrZero = WarnResult.successOrElse(() => 0)
|
|
681
729
|
*
|
|
682
730
|
* assert.deepStrictEqual(
|
|
683
|
-
*
|
|
684
|
-
*
|
|
731
|
+
* successOrZero(WarnResult.SuccessOnly({ success: 1 })),
|
|
732
|
+
* 1
|
|
685
733
|
* )
|
|
686
734
|
* assert.deepStrictEqual(
|
|
687
|
-
*
|
|
688
|
-
*
|
|
735
|
+
* successOrZero(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
736
|
+
* 0
|
|
689
737
|
* )
|
|
690
738
|
* ```
|
|
691
739
|
*
|
|
692
740
|
* @category getters
|
|
693
741
|
* @since 0.0.0
|
|
694
742
|
*/
|
|
695
|
-
declare const
|
|
743
|
+
declare const successOrElse: <Z>(orElseReturn: () => Z) => <W, A>(warnResult: WarnResult<W, A>) => A | Z;
|
|
696
744
|
/**
|
|
697
|
-
* Extracts the `
|
|
698
|
-
* present.
|
|
745
|
+
* Extracts the `success` value of a `WarnResult`, returning `undefined` when no
|
|
746
|
+
* `success` value is present.
|
|
699
747
|
*
|
|
700
|
-
* A specialisation of `
|
|
701
|
-
* `
|
|
748
|
+
* A specialisation of `successOrElse` whose fallback is `undefined`: `SuccessOnly`
|
|
749
|
+
* and `SuccessWithWarnings` yield their `success` value, while `WarningsOnly`
|
|
750
|
+
* yields `undefined`.
|
|
702
751
|
*
|
|
703
752
|
* @example
|
|
704
753
|
* ```ts
|
|
705
|
-
* import {
|
|
754
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
706
755
|
*
|
|
707
756
|
* assert.deepStrictEqual(
|
|
708
|
-
*
|
|
709
|
-
*
|
|
757
|
+
* WarnResult.successOrUndefined(WarnResult.SuccessOnly({ success: 1 })),
|
|
758
|
+
* 1
|
|
710
759
|
* )
|
|
711
760
|
* assert.deepStrictEqual(
|
|
712
|
-
*
|
|
761
|
+
* WarnResult.successOrUndefined(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
713
762
|
* undefined
|
|
714
763
|
* )
|
|
715
764
|
* ```
|
|
@@ -717,35 +766,35 @@ declare const rightOrElse: <A>(orElseReturn: () => A) => <L, R>(these: These<L,
|
|
|
717
766
|
* @category getters
|
|
718
767
|
* @since 0.0.0
|
|
719
768
|
*/
|
|
720
|
-
declare const
|
|
721
|
-
readonly _tag: "
|
|
722
|
-
readonly
|
|
769
|
+
declare const successOrUndefined: <W, A>(warnResult: {
|
|
770
|
+
readonly _tag: "WarningsOnly";
|
|
771
|
+
readonly warnings: W;
|
|
723
772
|
} | {
|
|
724
|
-
readonly _tag: "
|
|
725
|
-
readonly
|
|
773
|
+
readonly _tag: "SuccessOnly";
|
|
774
|
+
readonly success: A;
|
|
726
775
|
} | {
|
|
727
|
-
readonly _tag: "
|
|
728
|
-
readonly
|
|
729
|
-
readonly
|
|
730
|
-
}) =>
|
|
776
|
+
readonly _tag: "SuccessWithWarnings";
|
|
777
|
+
readonly warnings: W;
|
|
778
|
+
readonly success: A;
|
|
779
|
+
}) => A | undefined;
|
|
731
780
|
/**
|
|
732
|
-
* Extracts the `
|
|
781
|
+
* Extracts the `success` value of a `WarnResult` as an `Option`.
|
|
733
782
|
*
|
|
734
|
-
* `
|
|
735
|
-
* `Option.none()`. Use it when you want to chain the
|
|
736
|
-
* combinators rather than fall back to a default eagerly.
|
|
783
|
+
* `SuccessOnly` and `SuccessWithWarnings` yield `Option.some(success)`;
|
|
784
|
+
* `WarningsOnly` yields `Option.none()`. Use it when you want to chain the success
|
|
785
|
+
* value through `Option` combinators rather than fall back to a default eagerly.
|
|
737
786
|
*
|
|
738
787
|
* @example
|
|
739
788
|
* ```ts
|
|
740
|
-
* import {
|
|
789
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
741
790
|
* import { Option } from "effect"
|
|
742
791
|
*
|
|
743
792
|
* assert.deepStrictEqual(
|
|
744
|
-
*
|
|
745
|
-
* Option.some(
|
|
793
|
+
* WarnResult.successOption(WarnResult.SuccessOnly({ success: 1 })),
|
|
794
|
+
* Option.some(1)
|
|
746
795
|
* )
|
|
747
796
|
* assert.deepStrictEqual(
|
|
748
|
-
*
|
|
797
|
+
* WarnResult.successOption(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
749
798
|
* Option.none()
|
|
750
799
|
* )
|
|
751
800
|
* ```
|
|
@@ -753,24 +802,24 @@ declare const rightOrUndefined: <L, R>(these: {
|
|
|
753
802
|
* @category getters
|
|
754
803
|
* @since 0.0.0
|
|
755
804
|
*/
|
|
756
|
-
declare const
|
|
805
|
+
declare const successOption: <W, A>(warnResult: WarnResult<W, A>) => Option.Option<A>;
|
|
757
806
|
/**
|
|
758
|
-
* Extracts the `
|
|
807
|
+
* Extracts the `warnings` of a `WarnResult` as an `Option`.
|
|
759
808
|
*
|
|
760
|
-
* The mirror of `
|
|
761
|
-
* `Option.some(
|
|
809
|
+
* The mirror of `successOption`: `WarningsOnly` and `SuccessWithWarnings` yield
|
|
810
|
+
* `Option.some(warnings)`, while `SuccessOnly` yields `Option.none()`.
|
|
762
811
|
*
|
|
763
812
|
* @example
|
|
764
813
|
* ```ts
|
|
765
|
-
* import {
|
|
814
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
766
815
|
* import { Option } from "effect"
|
|
767
816
|
*
|
|
768
817
|
* assert.deepStrictEqual(
|
|
769
|
-
*
|
|
770
|
-
* Option.some(
|
|
818
|
+
* WarnResult.warningsOption(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
819
|
+
* Option.some("w")
|
|
771
820
|
* )
|
|
772
821
|
* assert.deepStrictEqual(
|
|
773
|
-
*
|
|
822
|
+
* WarnResult.warningsOption(WarnResult.SuccessOnly({ success: 1 })),
|
|
774
823
|
* Option.none()
|
|
775
824
|
* )
|
|
776
825
|
* ```
|
|
@@ -778,332 +827,350 @@ declare const rightOption: <L, R>(these: These<L, R>) => Option.Option<R>;
|
|
|
778
827
|
* @category getters
|
|
779
828
|
* @since 0.0.0
|
|
780
829
|
*/
|
|
781
|
-
declare const
|
|
830
|
+
declare const warningsOption: <W, A>(warnResult: WarnResult<W, A>) => Option.Option<W>;
|
|
782
831
|
/**
|
|
783
|
-
* Transforms both sides of a `
|
|
784
|
-
* `
|
|
832
|
+
* Transforms both sides of a `WarnResult`, applying `mapWarnings` to any
|
|
833
|
+
* `warnings` and `mapSuccess` to any `success` value.
|
|
785
834
|
*
|
|
786
|
-
* Each constructor is rebuilt with its mapped contents, so `
|
|
787
|
-
* the
|
|
788
|
-
* preserved. Use it as the bifunctor map
|
|
835
|
+
* Each constructor is rebuilt with its mapped contents, so `WarningsOnly` maps
|
|
836
|
+
* only the warnings, `SuccessOnly` only the success value, and
|
|
837
|
+
* `SuccessWithWarnings` both. The tag is preserved. Use it as the bifunctor map
|
|
838
|
+
* over `WarnResult`.
|
|
789
839
|
*
|
|
790
840
|
* @example
|
|
791
841
|
* ```ts
|
|
792
|
-
* import {
|
|
842
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
793
843
|
*
|
|
794
|
-
* const both =
|
|
795
|
-
*
|
|
796
|
-
*
|
|
844
|
+
* const both = WarnResult.mapBoth({
|
|
845
|
+
* mapWarnings: (warnings: string) => warnings.toUpperCase(),
|
|
846
|
+
* mapSuccess: (success: number) => success + 1
|
|
797
847
|
* })
|
|
798
848
|
*
|
|
799
849
|
* assert.deepStrictEqual(
|
|
800
|
-
* both(
|
|
801
|
-
*
|
|
850
|
+
* both(WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })),
|
|
851
|
+
* WarnResult.SuccessWithWarnings({ warnings: "W", success: 2 })
|
|
802
852
|
* )
|
|
803
853
|
* assert.deepStrictEqual(
|
|
804
|
-
* both(
|
|
805
|
-
*
|
|
854
|
+
* both(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
855
|
+
* WarnResult.WarningsOnly({ warnings: "W" })
|
|
806
856
|
* )
|
|
807
857
|
* ```
|
|
808
858
|
*
|
|
809
859
|
* @category mapping
|
|
810
860
|
* @since 0.0.0
|
|
811
861
|
*/
|
|
812
|
-
declare const mapBoth: <
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
}) => ((
|
|
862
|
+
declare const mapBoth: <W1, A1, W2, A2>({ mapWarnings, mapSuccess, }: {
|
|
863
|
+
mapWarnings: (warnings: W1) => W2;
|
|
864
|
+
mapSuccess: (success: A1) => A2;
|
|
865
|
+
}) => ((warnResult: WarnResult<W1, A1>) => WarnResult<W2, A2>);
|
|
816
866
|
/**
|
|
817
867
|
* Effectful `mapBoth`: transforms each present side through an `Effect`,
|
|
818
|
-
* reassembling the results into a `
|
|
868
|
+
* reassembling the results into a `WarnResult` inside an `Effect`.
|
|
819
869
|
*
|
|
820
|
-
* For `
|
|
821
|
-
* combined; `
|
|
822
|
-
* requirements from both mappers are unioned into the result type. Use it when
|
|
823
|
-
* mapping a `
|
|
870
|
+
* For `SuccessWithWarnings` both effects run via `Effect.all` and their results
|
|
871
|
+
* are combined; `WarningsOnly`/`SuccessOnly` run only the relevant effect. Errors
|
|
872
|
+
* and requirements from both mappers are unioned into the result type. Use it when
|
|
873
|
+
* mapping a `WarnResult`'s sides requires effects (validation, IO).
|
|
824
874
|
*
|
|
825
875
|
* @example
|
|
826
876
|
* ```ts
|
|
827
|
-
* import {
|
|
877
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
828
878
|
* import { Effect } from "effect"
|
|
829
879
|
*
|
|
830
|
-
* const both =
|
|
831
|
-
*
|
|
832
|
-
*
|
|
880
|
+
* const both = WarnResult.mapBothEffect({
|
|
881
|
+
* mapWarnings: (warnings: string) => Effect.succeed(warnings.toUpperCase()),
|
|
882
|
+
* mapSuccess: (success: number) => Effect.succeed(success + 1)
|
|
833
883
|
* })
|
|
834
884
|
*
|
|
835
885
|
* assert.deepStrictEqual(
|
|
836
|
-
* Effect.runSync(
|
|
837
|
-
*
|
|
886
|
+
* Effect.runSync(
|
|
887
|
+
* both(WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 }))
|
|
888
|
+
* ),
|
|
889
|
+
* WarnResult.SuccessWithWarnings({ warnings: "W", success: 2 })
|
|
838
890
|
* )
|
|
839
891
|
* ```
|
|
840
892
|
*
|
|
841
893
|
* @category sequencing
|
|
842
894
|
* @since 0.0.0
|
|
843
895
|
*/
|
|
844
|
-
declare const mapBothEffect: <
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
}) => ((
|
|
896
|
+
declare const mapBothEffect: <W1, A1, W2, A2, EW, EA, RW, RA>({ mapWarnings, mapSuccess, }: {
|
|
897
|
+
mapWarnings: (warnings: W1) => Effect.Effect<W2, EW, RW>;
|
|
898
|
+
mapSuccess: (success: A1) => Effect.Effect<A2, EA, RA>;
|
|
899
|
+
}) => ((warnResult: WarnResult<W1, A1>) => Effect.Effect<WarnResult<W2, A2>, EW | EA, RW | RA>);
|
|
848
900
|
/**
|
|
849
|
-
* Transforms the `
|
|
901
|
+
* Transforms the `warnings` of a `WarnResult`, leaving any `success` value
|
|
902
|
+
* untouched.
|
|
850
903
|
*
|
|
851
|
-
* A specialisation of `mapBoth` with the
|
|
852
|
-
* `
|
|
853
|
-
* through unchanged.
|
|
904
|
+
* A specialisation of `mapBoth` with the success mapper set to `identity`:
|
|
905
|
+
* `WarningsOnly` and `SuccessWithWarnings` have their `warnings` mapped, while
|
|
906
|
+
* `SuccessOnly` passes through unchanged.
|
|
854
907
|
*
|
|
855
908
|
* @example
|
|
856
909
|
* ```ts
|
|
857
|
-
* import {
|
|
910
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
858
911
|
*
|
|
859
|
-
* const
|
|
912
|
+
* const shout = WarnResult.mapWarnings((warnings: string) =>
|
|
913
|
+
* warnings.toUpperCase()
|
|
914
|
+
* )
|
|
860
915
|
*
|
|
861
916
|
* assert.deepStrictEqual(
|
|
862
|
-
*
|
|
863
|
-
*
|
|
917
|
+
* shout(WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })),
|
|
918
|
+
* WarnResult.SuccessWithWarnings({ warnings: "W", success: 1 })
|
|
864
919
|
* )
|
|
865
920
|
* assert.deepStrictEqual(
|
|
866
|
-
*
|
|
867
|
-
*
|
|
921
|
+
* shout(WarnResult.SuccessOnly({ success: 1 })),
|
|
922
|
+
* WarnResult.SuccessOnly({ success: 1 })
|
|
868
923
|
* )
|
|
869
924
|
* ```
|
|
870
925
|
*
|
|
871
926
|
* @category mapping
|
|
872
927
|
* @since 0.0.0
|
|
873
928
|
*/
|
|
874
|
-
declare const
|
|
929
|
+
declare const mapWarnings: <W1, W2>(mapWarnings: (warnings: W1) => W2) => (<A>(warnResult: WarnResult<W1, A>) => WarnResult<W2, A>);
|
|
875
930
|
/**
|
|
876
|
-
* Chains the `
|
|
931
|
+
* Chains the `warnings` of a `WarnResult` into a new `WarnResult`, flattening the
|
|
932
|
+
* result.
|
|
877
933
|
*
|
|
878
|
-
* Whenever
|
|
879
|
-
* `
|
|
880
|
-
* through unchanged. Use it to sequence
|
|
881
|
-
* produce a `
|
|
934
|
+
* Whenever `warnings` are present (`WarningsOnly` or `SuccessWithWarnings`) they
|
|
935
|
+
* are passed to `mapWarnings`, whose returned `WarnResult` replaces the original;
|
|
936
|
+
* `SuccessOnly` passes through unchanged. Use it to sequence warnings-driven
|
|
937
|
+
* computations that themselves produce a `WarnResult`.
|
|
882
938
|
*
|
|
883
939
|
* @example
|
|
884
940
|
* ```ts
|
|
885
|
-
* import {
|
|
941
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
886
942
|
*
|
|
887
|
-
* const chain =
|
|
888
|
-
*
|
|
889
|
-
* ?
|
|
890
|
-
* :
|
|
943
|
+
* const chain = WarnResult.flatMapWarnings((warnings: string) =>
|
|
944
|
+
* warnings.length > 0
|
|
945
|
+
* ? WarnResult.WarningsOnly({ warnings: warnings.toUpperCase() })
|
|
946
|
+
* : WarnResult.SuccessOnly({ success: 0 })
|
|
891
947
|
* )
|
|
892
948
|
*
|
|
893
949
|
* assert.deepStrictEqual(
|
|
894
|
-
* chain(
|
|
895
|
-
*
|
|
950
|
+
* chain(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
951
|
+
* WarnResult.WarningsOnly({ warnings: "W" })
|
|
896
952
|
* )
|
|
897
953
|
* assert.deepStrictEqual(
|
|
898
|
-
* chain(
|
|
899
|
-
*
|
|
954
|
+
* chain(WarnResult.SuccessOnly({ success: 1 })),
|
|
955
|
+
* WarnResult.SuccessOnly({ success: 1 })
|
|
900
956
|
* )
|
|
901
957
|
* ```
|
|
902
958
|
*
|
|
903
959
|
* @category sequencing
|
|
904
960
|
* @since 0.0.0
|
|
905
961
|
*/
|
|
906
|
-
declare const
|
|
962
|
+
declare const flatMapWarnings: <W1, W2, A2>(mapWarnings: (warnings: W1) => WarnResult<W2, A2>) => (<A1>(warnResult: WarnResult<W1, A1>) => WarnResult<W2, A1 | A2>);
|
|
907
963
|
/**
|
|
908
|
-
* Effectful `
|
|
909
|
-
* leaving any `
|
|
964
|
+
* Effectful `mapWarnings`: transforms the `warnings` of a `WarnResult` through an
|
|
965
|
+
* `Effect`, leaving any `success` value untouched.
|
|
910
966
|
*
|
|
911
|
-
* A specialisation of `mapBothEffect` with the
|
|
912
|
-
* `Effect.succeed`: the `
|
|
913
|
-
* `
|
|
967
|
+
* A specialisation of `mapBothEffect` with the success mapper set to
|
|
968
|
+
* `Effect.succeed`: the `warnings` (when present) are mapped effectfully and the
|
|
969
|
+
* `success` value is carried through unchanged.
|
|
914
970
|
*
|
|
915
971
|
* @example
|
|
916
972
|
* ```ts
|
|
917
|
-
* import {
|
|
973
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
918
974
|
* import { Effect } from "effect"
|
|
919
975
|
*
|
|
920
|
-
* const
|
|
976
|
+
* const shout = WarnResult.mapWarningsEffect((warnings: string) =>
|
|
977
|
+
* Effect.succeed(warnings.toUpperCase())
|
|
978
|
+
* )
|
|
921
979
|
*
|
|
922
980
|
* assert.deepStrictEqual(
|
|
923
|
-
* Effect.runSync(
|
|
924
|
-
*
|
|
981
|
+
* Effect.runSync(
|
|
982
|
+
* shout(WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 }))
|
|
983
|
+
* ),
|
|
984
|
+
* WarnResult.SuccessWithWarnings({ warnings: "W", success: 1 })
|
|
925
985
|
* )
|
|
926
986
|
* ```
|
|
927
987
|
*
|
|
928
988
|
* @category sequencing
|
|
929
989
|
* @since 0.0.0
|
|
930
990
|
*/
|
|
931
|
-
declare const
|
|
991
|
+
declare const mapWarningsEffect: <W1, W2, EW, RW>(mapWarnings: (warnings: W1) => Effect.Effect<W2, EW, RW>) => (<A>(warnResult: WarnResult<W1, A>) => Effect.Effect<WarnResult<W2, A>, EW, RW>);
|
|
932
992
|
/**
|
|
933
|
-
* Effectful `
|
|
934
|
-
* yields a new `
|
|
993
|
+
* Effectful `flatMapWarnings`: chains the `warnings` of a `WarnResult` into an
|
|
994
|
+
* `Effect` that yields a new `WarnResult`, flattening the result.
|
|
935
995
|
*
|
|
936
|
-
* When
|
|
937
|
-
* replaces the original; `
|
|
938
|
-
* it to sequence
|
|
996
|
+
* When `warnings` are present they are passed to `mapWarnings`, whose effectful
|
|
997
|
+
* `WarnResult` replaces the original; `SuccessOnly` is lifted unchanged via
|
|
998
|
+
* `Effect.succeed`. Use it to sequence warnings-driven effectful computations that
|
|
999
|
+
* produce a `WarnResult`.
|
|
939
1000
|
*
|
|
940
1001
|
* @example
|
|
941
1002
|
* ```ts
|
|
942
|
-
* import {
|
|
1003
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
943
1004
|
* import { Effect } from "effect"
|
|
944
1005
|
*
|
|
945
|
-
* const chain =
|
|
946
|
-
* Effect.succeed(
|
|
1006
|
+
* const chain = WarnResult.flatMapWarningsEffect((warnings: string) =>
|
|
1007
|
+
* Effect.succeed(WarnResult.WarningsOnly({ warnings: warnings.toUpperCase() }))
|
|
947
1008
|
* )
|
|
948
1009
|
*
|
|
949
1010
|
* assert.deepStrictEqual(
|
|
950
|
-
* Effect.runSync(chain(
|
|
951
|
-
*
|
|
1011
|
+
* Effect.runSync(chain(WarnResult.WarningsOnly({ warnings: "w" }))),
|
|
1012
|
+
* WarnResult.WarningsOnly({ warnings: "W" })
|
|
952
1013
|
* )
|
|
953
1014
|
* assert.deepStrictEqual(
|
|
954
|
-
* Effect.runSync(chain(
|
|
955
|
-
*
|
|
1015
|
+
* Effect.runSync(chain(WarnResult.SuccessOnly({ success: 1 }))),
|
|
1016
|
+
* WarnResult.SuccessOnly({ success: 1 })
|
|
956
1017
|
* )
|
|
957
1018
|
* ```
|
|
958
1019
|
*
|
|
959
1020
|
* @category sequencing
|
|
960
1021
|
* @since 0.0.0
|
|
961
1022
|
*/
|
|
962
|
-
declare const
|
|
1023
|
+
declare const flatMapWarningsEffect: <W1, W2, A2, EW, RW>(mapWarnings: (warnings: W1) => Effect.Effect<WarnResult<W2, A2>, EW, RW>) => (<A1>(warnResult: WarnResult<W1, A1>) => Effect.Effect<WarnResult<W2, A1 | A2>, EW, RW>);
|
|
963
1024
|
/**
|
|
964
|
-
* Transforms the `
|
|
1025
|
+
* Transforms the `success` value of a `WarnResult`, leaving any `warnings`
|
|
1026
|
+
* untouched.
|
|
965
1027
|
*
|
|
966
|
-
* The mirror of `
|
|
967
|
-
* mapped, while `
|
|
1028
|
+
* The mirror of `mapWarnings`: `SuccessOnly` and `SuccessWithWarnings` have their
|
|
1029
|
+
* `success` value mapped, while `WarningsOnly` passes through unchanged.
|
|
968
1030
|
*
|
|
969
1031
|
* @example
|
|
970
1032
|
* ```ts
|
|
971
|
-
* import {
|
|
1033
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
972
1034
|
*
|
|
973
|
-
* const
|
|
1035
|
+
* const inc = WarnResult.mapSuccess((success: number) => success + 1)
|
|
974
1036
|
*
|
|
975
1037
|
* assert.deepStrictEqual(
|
|
976
|
-
*
|
|
977
|
-
*
|
|
1038
|
+
* inc(WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })),
|
|
1039
|
+
* WarnResult.SuccessWithWarnings({ warnings: "w", success: 2 })
|
|
978
1040
|
* )
|
|
979
1041
|
* assert.deepStrictEqual(
|
|
980
|
-
*
|
|
981
|
-
*
|
|
1042
|
+
* inc(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
1043
|
+
* WarnResult.WarningsOnly({ warnings: "w" })
|
|
982
1044
|
* )
|
|
983
1045
|
* ```
|
|
984
1046
|
*
|
|
985
1047
|
* @category mapping
|
|
986
1048
|
* @since 0.0.0
|
|
987
1049
|
*/
|
|
988
|
-
declare const
|
|
1050
|
+
declare const mapSuccess: <A1, A2>(mapSuccess: (success: A1) => A2) => (<W>(warnResult: WarnResult<W, A1>) => WarnResult<W, A2>);
|
|
989
1051
|
/**
|
|
990
|
-
* Chains the `
|
|
1052
|
+
* Chains the `success` value of a `WarnResult` into a new `WarnResult`, flattening
|
|
1053
|
+
* the result.
|
|
991
1054
|
*
|
|
992
|
-
* The mirror of `
|
|
993
|
-
* `
|
|
994
|
-
* original; `
|
|
1055
|
+
* The mirror of `flatMapWarnings`: whenever a `success` value is present
|
|
1056
|
+
* (`SuccessOnly` or `SuccessWithWarnings`) it is passed to `mapSuccess`, whose
|
|
1057
|
+
* returned `WarnResult` replaces the original; `WarningsOnly` passes through
|
|
1058
|
+
* unchanged.
|
|
995
1059
|
*
|
|
996
1060
|
* @example
|
|
997
1061
|
* ```ts
|
|
998
|
-
* import {
|
|
1062
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
999
1063
|
*
|
|
1000
|
-
* const chain =
|
|
1001
|
-
*
|
|
1064
|
+
* const chain = WarnResult.flatMapSuccess((success: number) =>
|
|
1065
|
+
* WarnResult.SuccessOnly({ success: success + 1 })
|
|
1002
1066
|
* )
|
|
1003
1067
|
*
|
|
1004
1068
|
* assert.deepStrictEqual(
|
|
1005
|
-
* chain(
|
|
1006
|
-
*
|
|
1069
|
+
* chain(WarnResult.SuccessOnly({ success: 1 })),
|
|
1070
|
+
* WarnResult.SuccessOnly({ success: 2 })
|
|
1007
1071
|
* )
|
|
1008
1072
|
* assert.deepStrictEqual(
|
|
1009
|
-
* chain(
|
|
1010
|
-
*
|
|
1073
|
+
* chain(WarnResult.WarningsOnly({ warnings: "w" })),
|
|
1074
|
+
* WarnResult.WarningsOnly({ warnings: "w" })
|
|
1011
1075
|
* )
|
|
1012
1076
|
* ```
|
|
1013
1077
|
*
|
|
1014
1078
|
* @category sequencing
|
|
1015
1079
|
* @since 0.0.0
|
|
1016
1080
|
*/
|
|
1017
|
-
declare const
|
|
1081
|
+
declare const flatMapSuccess: <W2, A1, A2>(mapSuccess: (success: A1) => WarnResult<W2, A2>) => (<W1>(warnResult: WarnResult<W1, A1>) => WarnResult<W1 | W2, A2>);
|
|
1018
1082
|
/**
|
|
1019
|
-
* Effectful `
|
|
1020
|
-
* leaving any `
|
|
1083
|
+
* Effectful `mapSuccess`: transforms the `success` value of a `WarnResult` through
|
|
1084
|
+
* an `Effect`, leaving any `warnings` untouched.
|
|
1021
1085
|
*
|
|
1022
|
-
* The mirror of `
|
|
1023
|
-
* and the `
|
|
1086
|
+
* The mirror of `mapWarningsEffect`: the `success` value (when present) is mapped
|
|
1087
|
+
* effectfully and the `warnings` are carried through unchanged via
|
|
1088
|
+
* `Effect.succeed`.
|
|
1024
1089
|
*
|
|
1025
1090
|
* @example
|
|
1026
1091
|
* ```ts
|
|
1027
|
-
* import {
|
|
1092
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
1028
1093
|
* import { Effect } from "effect"
|
|
1029
1094
|
*
|
|
1030
|
-
* const
|
|
1031
|
-
* Effect.succeed(
|
|
1095
|
+
* const inc = WarnResult.mapSuccessEffect((success: number) =>
|
|
1096
|
+
* Effect.succeed(success + 1)
|
|
1032
1097
|
* )
|
|
1033
1098
|
*
|
|
1034
1099
|
* assert.deepStrictEqual(
|
|
1035
|
-
* Effect.runSync(
|
|
1036
|
-
*
|
|
1100
|
+
* Effect.runSync(
|
|
1101
|
+
* inc(WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 }))
|
|
1102
|
+
* ),
|
|
1103
|
+
* WarnResult.SuccessWithWarnings({ warnings: "w", success: 2 })
|
|
1037
1104
|
* )
|
|
1038
1105
|
* ```
|
|
1039
1106
|
*
|
|
1040
1107
|
* @category sequencing
|
|
1041
1108
|
* @since 0.0.0
|
|
1042
1109
|
*/
|
|
1043
|
-
declare const
|
|
1110
|
+
declare const mapSuccessEffect: <A1, A2, EA, RA>(mapSuccess: (success: A1) => Effect.Effect<A2, EA, RA>) => (<W>(warnResult: WarnResult<W, A1>) => Effect.Effect<WarnResult<W, A2>, EA, RA>);
|
|
1044
1111
|
/**
|
|
1045
|
-
* Effectful `
|
|
1046
|
-
* yields a new `
|
|
1112
|
+
* Effectful `flatMapSuccess`: chains the `success` value of a `WarnResult` into an
|
|
1113
|
+
* `Effect` that yields a new `WarnResult`, flattening the result.
|
|
1047
1114
|
*
|
|
1048
|
-
* The mirror of `
|
|
1049
|
-
* `
|
|
1050
|
-
* unchanged via `Effect.succeed`.
|
|
1115
|
+
* The mirror of `flatMapWarningsEffect`: when a `success` value is present it is
|
|
1116
|
+
* passed to `mapSuccess`, whose effectful `WarnResult` replaces the original;
|
|
1117
|
+
* `WarningsOnly` is lifted unchanged via `Effect.succeed`.
|
|
1051
1118
|
*
|
|
1052
1119
|
* @example
|
|
1053
1120
|
* ```ts
|
|
1054
|
-
* import {
|
|
1121
|
+
* import { WarnResult } from "@nunofyobiz/effect-extras"
|
|
1055
1122
|
* import { Effect } from "effect"
|
|
1056
1123
|
*
|
|
1057
|
-
* const chain =
|
|
1058
|
-
* Effect.succeed(
|
|
1124
|
+
* const chain = WarnResult.flatMapSuccessEffect((success: number) =>
|
|
1125
|
+
* Effect.succeed(WarnResult.SuccessOnly({ success: success + 1 }))
|
|
1059
1126
|
* )
|
|
1060
1127
|
*
|
|
1061
1128
|
* assert.deepStrictEqual(
|
|
1062
|
-
* Effect.runSync(chain(
|
|
1063
|
-
*
|
|
1129
|
+
* Effect.runSync(chain(WarnResult.SuccessOnly({ success: 1 }))),
|
|
1130
|
+
* WarnResult.SuccessOnly({ success: 2 })
|
|
1064
1131
|
* )
|
|
1065
1132
|
* assert.deepStrictEqual(
|
|
1066
|
-
* Effect.runSync(chain(
|
|
1067
|
-
*
|
|
1133
|
+
* Effect.runSync(chain(WarnResult.WarningsOnly({ warnings: "w" }))),
|
|
1134
|
+
* WarnResult.WarningsOnly({ warnings: "w" })
|
|
1068
1135
|
* )
|
|
1069
1136
|
* ```
|
|
1070
1137
|
*
|
|
1071
1138
|
* @category sequencing
|
|
1072
1139
|
* @since 0.0.0
|
|
1073
1140
|
*/
|
|
1074
|
-
declare const
|
|
1141
|
+
declare const flatMapSuccessEffect: <W2, A1, A2, EA, RA>(mapSuccess: (success: A1) => Effect.Effect<WarnResult<W2, A2>, EA, RA>) => (<W1>(warnResult: WarnResult<W1, A1>) => Effect.Effect<WarnResult<W1 | W2, A2>, EA, RA>);
|
|
1075
1142
|
|
|
1076
|
-
declare const
|
|
1077
|
-
declare const
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
declare const
|
|
1081
|
-
declare const
|
|
1082
|
-
declare const
|
|
1083
|
-
declare const
|
|
1084
|
-
declare const
|
|
1085
|
-
declare const
|
|
1086
|
-
declare const
|
|
1087
|
-
declare const
|
|
1088
|
-
declare const
|
|
1089
|
-
declare const
|
|
1090
|
-
declare const
|
|
1091
|
-
declare const
|
|
1092
|
-
declare const
|
|
1093
|
-
declare const
|
|
1094
|
-
declare const
|
|
1095
|
-
declare const
|
|
1096
|
-
declare const
|
|
1097
|
-
declare const
|
|
1098
|
-
declare const
|
|
1099
|
-
declare const
|
|
1100
|
-
declare const
|
|
1101
|
-
declare const
|
|
1102
|
-
declare const
|
|
1103
|
-
declare const
|
|
1104
|
-
declare const
|
|
1105
|
-
declare namespace
|
|
1106
|
-
export {
|
|
1143
|
+
declare const WarnResult$1_SuccessOnly: typeof SuccessOnly;
|
|
1144
|
+
declare const WarnResult$1_SuccessWithWarnings: typeof SuccessWithWarnings;
|
|
1145
|
+
type WarnResult$1_WarnResult<W, A> = WarnResult<W, A>;
|
|
1146
|
+
declare const WarnResult$1_WarningsOnly: typeof WarningsOnly;
|
|
1147
|
+
declare const WarnResult$1_WithSuccess: typeof WithSuccess;
|
|
1148
|
+
declare const WarnResult$1_WithWarnings: typeof WithWarnings;
|
|
1149
|
+
declare const WarnResult$1_flatMapSuccess: typeof flatMapSuccess;
|
|
1150
|
+
declare const WarnResult$1_flatMapSuccessEffect: typeof flatMapSuccessEffect;
|
|
1151
|
+
declare const WarnResult$1_flatMapWarnings: typeof flatMapWarnings;
|
|
1152
|
+
declare const WarnResult$1_flatMapWarningsEffect: typeof flatMapWarningsEffect;
|
|
1153
|
+
declare const WarnResult$1_fromNullables: typeof fromNullables;
|
|
1154
|
+
declare const WarnResult$1_is: typeof is;
|
|
1155
|
+
declare const WarnResult$1_mapBoth: typeof mapBoth;
|
|
1156
|
+
declare const WarnResult$1_mapBothEffect: typeof mapBothEffect;
|
|
1157
|
+
declare const WarnResult$1_mapSuccess: typeof mapSuccess;
|
|
1158
|
+
declare const WarnResult$1_mapSuccessEffect: typeof mapSuccessEffect;
|
|
1159
|
+
declare const WarnResult$1_mapWarnings: typeof mapWarnings;
|
|
1160
|
+
declare const WarnResult$1_mapWarningsEffect: typeof mapWarningsEffect;
|
|
1161
|
+
declare const WarnResult$1_matchSuccess: typeof matchSuccess;
|
|
1162
|
+
declare const WarnResult$1_matchWarnings: typeof matchWarnings;
|
|
1163
|
+
declare const WarnResult$1_optionFromNullables: typeof optionFromNullables;
|
|
1164
|
+
declare const WarnResult$1_orElse: typeof orElse;
|
|
1165
|
+
declare const WarnResult$1_orUndefined: typeof orUndefined;
|
|
1166
|
+
declare const WarnResult$1_successOption: typeof successOption;
|
|
1167
|
+
declare const WarnResult$1_successOrElse: typeof successOrElse;
|
|
1168
|
+
declare const WarnResult$1_successOrUndefined: typeof successOrUndefined;
|
|
1169
|
+
declare const WarnResult$1_warningsOption: typeof warningsOption;
|
|
1170
|
+
declare const WarnResult$1_warningsOrElse: typeof warningsOrElse;
|
|
1171
|
+
declare const WarnResult$1_warningsOrUndefined: typeof warningsOrUndefined;
|
|
1172
|
+
declare namespace WarnResult$1 {
|
|
1173
|
+
export { WarnResult$1_SuccessOnly as SuccessOnly, WarnResult$1_SuccessWithWarnings as SuccessWithWarnings, type WarnResult$1_WarnResult as WarnResult, WarnResult$1_WarningsOnly as WarningsOnly, WarnResult$1_WithSuccess as WithSuccess, WarnResult$1_WithWarnings as WithWarnings, WarnResult$1_flatMapSuccess as flatMapSuccess, WarnResult$1_flatMapSuccessEffect as flatMapSuccessEffect, WarnResult$1_flatMapWarnings as flatMapWarnings, WarnResult$1_flatMapWarningsEffect as flatMapWarningsEffect, WarnResult$1_fromNullables as fromNullables, WarnResult$1_is as is, WarnResult$1_mapBoth as mapBoth, WarnResult$1_mapBothEffect as mapBothEffect, WarnResult$1_mapSuccess as mapSuccess, WarnResult$1_mapSuccessEffect as mapSuccessEffect, WarnResult$1_mapWarnings as mapWarnings, WarnResult$1_mapWarningsEffect as mapWarningsEffect, match$1 as match, WarnResult$1_matchSuccess as matchSuccess, WarnResult$1_matchWarnings as matchWarnings, WarnResult$1_optionFromNullables as optionFromNullables, WarnResult$1_orElse as orElse, WarnResult$1_orUndefined as orUndefined, WarnResult$1_successOption as successOption, WarnResult$1_successOrElse as successOrElse, WarnResult$1_successOrUndefined as successOrUndefined, WarnResult$1_warningsOption as warningsOption, WarnResult$1_warningsOrElse as warningsOrElse, WarnResult$1_warningsOrUndefined as warningsOrUndefined };
|
|
1107
1174
|
}
|
|
1108
1175
|
|
|
1109
1176
|
/**
|
|
@@ -1137,36 +1204,38 @@ declare namespace These$1 {
|
|
|
1137
1204
|
*/
|
|
1138
1205
|
declare const slice: (<A>(start: number, end: number) => (array: readonly A[]) => A[]) & (<A>(array: readonly A[], start: number, end: number) => A[]);
|
|
1139
1206
|
/**
|
|
1140
|
-
* Zips two arrays into one, calling `f` with a `
|
|
1141
|
-
* length mismatches are handled explicitly rather than truncated.
|
|
1207
|
+
* Zips two arrays into one, calling `f` with a `WarnResult` for each index so
|
|
1208
|
+
* that length mismatches are handled explicitly rather than truncated.
|
|
1142
1209
|
*
|
|
1143
1210
|
* Unlike `Array.zipWith` (which stops at the shorter array), this walks to the
|
|
1144
|
-
* length of the *longer* array.
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1147
|
-
*
|
|
1211
|
+
* length of the *longer* array. The first array's element fills the `warnings`
|
|
1212
|
+
* side and the second array's element fills the `success` side, so at each index
|
|
1213
|
+
* `f` receives a `WarnResult.WarnResult<A, B>`: `SuccessWithWarnings` when both
|
|
1214
|
+
* arrays have an element, `WarningsOnly` when only the first does, and
|
|
1215
|
+
* `SuccessOnly` when only the second does. Use it when the "extra" tail of either
|
|
1216
|
+
* array still carries meaning.
|
|
1148
1217
|
*
|
|
1149
1218
|
* @example
|
|
1150
1219
|
* ```ts
|
|
1151
|
-
* import { ArrayX,
|
|
1220
|
+
* import { ArrayX, WarnResult } from "@nunofyobiz/effect-extras"
|
|
1152
1221
|
*
|
|
1153
|
-
* const describe =
|
|
1154
|
-
*
|
|
1155
|
-
*
|
|
1156
|
-
*
|
|
1222
|
+
* const describe = WarnResult.match({
|
|
1223
|
+
* WarningsOnly: ({ warnings }) => `warnings ${warnings}`,
|
|
1224
|
+
* SuccessOnly: ({ success }) => `success ${success}`,
|
|
1225
|
+
* SuccessWithWarnings: ({ warnings, success }) => `both ${warnings}/${success}`,
|
|
1157
1226
|
* })
|
|
1158
1227
|
*
|
|
1159
|
-
* assert.deepStrictEqual(ArrayX.
|
|
1228
|
+
* assert.deepStrictEqual(ArrayX.zipWithWarnings([1, 2, 3], [10, 20], describe), [
|
|
1160
1229
|
* "both 1/10",
|
|
1161
1230
|
* "both 2/20",
|
|
1162
|
-
* "
|
|
1231
|
+
* "warnings 3",
|
|
1163
1232
|
* ])
|
|
1164
1233
|
* ```
|
|
1165
1234
|
*
|
|
1166
1235
|
* @category combinators
|
|
1167
1236
|
* @since 0.0.0
|
|
1168
1237
|
*/
|
|
1169
|
-
declare const
|
|
1238
|
+
declare const zipWithWarnings: (<A, B, C>(f: (ab: WarnResult<A, B>) => C) => (array1: readonly A[], array2: readonly B[]) => C[]) & (<A, B, C>(array1: readonly A[], array2: readonly B[], f: (ab: WarnResult<A, B>) => C) => C[]);
|
|
1170
1239
|
/**
|
|
1171
1240
|
* Inserts or moves a unique item in an array at a specified position.
|
|
1172
1241
|
*
|
|
@@ -1529,9 +1598,9 @@ declare const ArrayX_insertUniq: typeof insertUniq;
|
|
|
1529
1598
|
declare const ArrayX_mapRightAccum: typeof mapRightAccum;
|
|
1530
1599
|
declare const ArrayX_maxOption: typeof maxOption;
|
|
1531
1600
|
declare const ArrayX_slice: typeof slice;
|
|
1532
|
-
declare const
|
|
1601
|
+
declare const ArrayX_zipWithWarnings: typeof zipWithWarnings;
|
|
1533
1602
|
declare namespace ArrayX {
|
|
1534
|
-
export { ArrayX_categorize as categorize, ArrayX_chunkBy as chunkBy, ArrayX_compactNullable as compactNullable, ArrayX_filterHead as filterHead, ArrayX_filterMapNullable as filterMapNullable, ArrayX_filterTail as filterTail, ArrayX_findFirstWithIndex2d as findFirstWithIndex2d, ArrayX_insertUniq as insertUniq, ArrayX_mapRightAccum as mapRightAccum, ArrayX_maxOption as maxOption, ArrayX_slice as slice, takeFirstWhere$1 as takeFirstWhere, takeLastWhere$1 as takeLastWhere,
|
|
1603
|
+
export { ArrayX_categorize as categorize, ArrayX_chunkBy as chunkBy, ArrayX_compactNullable as compactNullable, ArrayX_filterHead as filterHead, ArrayX_filterMapNullable as filterMapNullable, ArrayX_filterTail as filterTail, ArrayX_findFirstWithIndex2d as findFirstWithIndex2d, ArrayX_insertUniq as insertUniq, ArrayX_mapRightAccum as mapRightAccum, ArrayX_maxOption as maxOption, ArrayX_slice as slice, takeFirstWhere$1 as takeFirstWhere, takeLastWhere$1 as takeLastWhere, ArrayX_zipWithWarnings as zipWithWarnings };
|
|
1535
1604
|
}
|
|
1536
1605
|
|
|
1537
1606
|
/**
|
|
@@ -3700,4 +3769,4 @@ declare namespace StructX {
|
|
|
3700
3769
|
export { type StructX_PartialTransform as PartialTransform, StructX_defined as defined, StructX_filterDefined as filterDefined, StructX_hasNotNullableProperty as hasNotNullableProperty, StructX_pickSome as pickSome, StructX_some as some, StructX_truthy as truthy };
|
|
3701
3770
|
}
|
|
3702
3771
|
|
|
3703
|
-
export { ArrayX, BigIntX, BooleanX, DurationX, EffectX, FormDataX, MapX, NonNullableX, NumberX, OptionX, OrderX, PredicateX, PromiseX, RecordX, ResultX, SchemaX, SetX, StringX, StructX,
|
|
3772
|
+
export { ArrayX, BigIntX, BooleanX, DurationX, EffectX, FormDataX, MapX, NonNullableX, NumberX, OptionX, OrderX, PredicateX, PromiseX, RecordX, ResultX, SchemaX, SetX, StringX, StructX, WarnResult$1 as WarnResult, fromNullableOrThrow as nn };
|