@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/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 value carrying a left `L`, a right `R`, or both at oncethe data type for
6
- * an "inclusive or".
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<R, L>` models an exclusive choice (success _or_ failure),
9
- * `These` adds the third case where both sides are present. It is a tagged enum
10
- * with three constructors: `LeftOnly` (only `left`), `RightOnly` (only `right`),
11
- * and `LeftAndRight` (both). Reach for it when an operation can produce partial
12
- * results — e.g. a parse that yields a value _and_ a list of warnings.
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 { These } from "@nunofyobiz/effect-extras"
18
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
17
19
  *
18
- * const both: These.These<number, string> = These.LeftAndRight({
19
- * left: 1,
20
- * right: "a"
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, "LeftAndRight")
26
+ * assert.deepStrictEqual(both._tag, "SuccessWithWarnings")
24
27
  * ```
25
28
  *
26
29
  * @category models
27
30
  * @since 0.0.0
28
31
  */
29
- type These<L, R> = Data.TaggedEnum<{
30
- LeftOnly: {
31
- readonly left: L;
32
+ type WarnResult<W, A> = Data.TaggedEnum<{
33
+ WarningsOnly: {
34
+ readonly warnings: W;
32
35
  };
33
- RightOnly: {
34
- readonly right: R;
36
+ SuccessOnly: {
37
+ readonly success: A;
35
38
  };
36
- LeftAndRight: {
37
- readonly left: L;
38
- readonly right: R;
39
+ SuccessWithWarnings: {
40
+ readonly warnings: W;
41
+ readonly success: A;
39
42
  };
40
43
  }>;
41
44
  /**
42
- * The `LeftOnly` member of `These` — a value that carries only a `left` and no
43
- * `right`.
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 { These } from "@nunofyobiz/effect-extras"
50
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
48
51
  *
49
- * const value: These.LeftOnly<number> = These.LeftOnly({ left: 1 })
52
+ * const value: WarnResult.WarningsOnly<string> = WarnResult.WarningsOnly({
53
+ * warnings: "skipped 2 rows"
54
+ * })
50
55
  *
51
- * assert.deepStrictEqual(value.left, 1)
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 LeftOnly<L> = These<L, never> & {
58
- _tag: "LeftOnly";
62
+ type WarningsOnly<W> = WarnResult<W, never> & {
63
+ _tag: "WarningsOnly";
59
64
  };
60
65
  /**
61
- * Constructs a `LeftOnly` — a `These` that carries only a `left`.
66
+ * Constructs a `WarningsOnly` — a `WarnResult` that carries only `warnings`.
62
67
  *
63
68
  * @example
64
69
  * ```ts
65
- * import { These } from "@nunofyobiz/effect-extras"
70
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
66
71
  *
67
- * const value = These.LeftOnly({ left: 1 })
72
+ * const value = WarnResult.WarningsOnly({ warnings: "skipped 2 rows" })
68
73
  *
69
- * assert.deepStrictEqual(value._tag, "LeftOnly")
70
- * assert.deepStrictEqual(value.left, 1)
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 LeftOnly: <A, B>(args: {
77
- readonly left: A;
81
+ declare const WarningsOnly: <A, B>(args: {
82
+ readonly warnings: A;
78
83
  }) => {
79
- readonly _tag: "LeftOnly";
80
- readonly left: A;
84
+ readonly _tag: "WarningsOnly";
85
+ readonly warnings: A;
81
86
  };
82
87
  /**
83
- * The `RightOnly` member of `These` — a value that carries only a `right` and no
84
- * `left`.
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 { These } from "@nunofyobiz/effect-extras"
93
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
89
94
  *
90
- * const value: These.RightOnly<string> = These.RightOnly({ right: "a" })
95
+ * const value: WarnResult.SuccessOnly<number> = WarnResult.SuccessOnly({
96
+ * success: 1
97
+ * })
91
98
  *
92
- * assert.deepStrictEqual(value.right, "a")
99
+ * assert.deepStrictEqual(value.success, 1)
93
100
  * ```
94
101
  *
95
102
  * @category models
96
103
  * @since 0.0.0
97
104
  */
98
- type RightOnly<R> = These<never, R> & {
99
- _tag: "RightOnly";
105
+ type SuccessOnly<A> = WarnResult<never, A> & {
106
+ _tag: "SuccessOnly";
100
107
  };
101
108
  /**
102
- * Constructs a `RightOnly` — a `These` that carries only a `right`.
109
+ * Constructs a `SuccessOnly` — a `WarnResult` that carries only a `success` value.
103
110
  *
104
111
  * @example
105
112
  * ```ts
106
- * import { These } from "@nunofyobiz/effect-extras"
113
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
107
114
  *
108
- * const value = These.RightOnly({ right: "a" })
115
+ * const value = WarnResult.SuccessOnly({ success: 1 })
109
116
  *
110
- * assert.deepStrictEqual(value._tag, "RightOnly")
111
- * assert.deepStrictEqual(value.right, "a")
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 RightOnly: <A, B>(args: {
118
- readonly right: B;
124
+ declare const SuccessOnly: <A, B>(args: {
125
+ readonly success: B;
119
126
  }) => {
120
- readonly _tag: "RightOnly";
121
- readonly right: B;
127
+ readonly _tag: "SuccessOnly";
128
+ readonly success: B;
122
129
  };
123
130
  /**
124
- * The `LeftAndRight` member of `These` — a value that carries both a `left` and a
125
- * `right`.
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 { These } from "@nunofyobiz/effect-extras"
136
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
130
137
  *
131
- * const value: These.LeftAndRight<number, string> = These.LeftAndRight({
132
- * left: 1,
133
- * right: "a"
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, { _tag: "LeftAndRight", left: 1, right: "a" })
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 LeftAndRight<L, R> = These<L, R> & {
143
- _tag: "LeftAndRight";
154
+ type SuccessWithWarnings<W, A> = WarnResult<W, A> & {
155
+ _tag: "SuccessWithWarnings";
144
156
  };
145
157
  /**
146
- * Constructs a `LeftAndRight` — a `These` that carries both a `left` and a
147
- * `right`.
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 { These } from "@nunofyobiz/effect-extras"
163
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
152
164
  *
153
- * const value = These.LeftAndRight({ left: 1, right: "a" })
165
+ * const value = WarnResult.SuccessWithWarnings({
166
+ * warnings: "rounded down",
167
+ * success: 1
168
+ * })
154
169
  *
155
- * assert.deepStrictEqual(value._tag, "LeftAndRight")
156
- * assert.deepStrictEqual(value.left, 1)
157
- * assert.deepStrictEqual(value.right, "a")
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 LeftAndRight: <A, B>(args: {
164
- readonly left: A;
165
- readonly right: B;
178
+ declare const SuccessWithWarnings: <A, B>(args: {
179
+ readonly warnings: A;
180
+ readonly success: B;
166
181
  }) => {
167
- readonly _tag: "LeftAndRight";
168
- readonly left: A;
169
- readonly right: B;
182
+ readonly _tag: "SuccessWithWarnings";
183
+ readonly warnings: A;
184
+ readonly success: B;
170
185
  };
171
186
  /**
172
- * Builds per-tag refinements for `These`. `is("LeftOnly")` is a type guard that
173
- * narrows a `These` to its `LeftOnly` member, and likewise for `"RightOnly"` and
174
- * `"LeftAndRight"`.
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 { These } from "@nunofyobiz/effect-extras"
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
- * These.is("LeftOnly")(These.RightOnly({ right: "a" })),
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 "LeftOnly" | "RightOnly" | "LeftAndRight">(tag: Tag) => {
208
+ declare const is: <Tag extends "WarningsOnly" | "SuccessOnly" | "SuccessWithWarnings">(tag: Tag) => {
191
209
  <T extends {
192
- readonly _tag: "LeftOnly";
193
- readonly left: any;
210
+ readonly _tag: "WarningsOnly";
211
+ readonly warnings: any;
194
212
  } | {
195
- readonly _tag: "RightOnly";
196
- readonly right: any;
213
+ readonly _tag: "SuccessOnly";
214
+ readonly success: any;
197
215
  } | {
198
- readonly _tag: "LeftAndRight";
199
- readonly left: any;
200
- readonly right: any;
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: "LeftOnly";
206
- readonly left: unknown;
223
+ readonly _tag: "WarningsOnly";
224
+ readonly warnings: unknown;
207
225
  }, {
208
226
  readonly _tag: Tag;
209
227
  }> | Extract<{
210
- readonly _tag: "RightOnly";
211
- readonly right: unknown;
228
+ readonly _tag: "SuccessOnly";
229
+ readonly success: unknown;
212
230
  }, {
213
231
  readonly _tag: Tag;
214
232
  }> | Extract<{
215
- readonly _tag: "LeftAndRight";
216
- readonly left: unknown;
217
- readonly right: unknown;
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 `These` over its three tags. Provide a handler for `LeftOnly`,
224
- * `RightOnly`, and `LeftAndRight` and `match` returns a function from a `These`
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 { These } from "@nunofyobiz/effect-extras"
247
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
230
248
  *
231
- * const describe = These.match({
232
- * LeftOnly: ({ left }) => `left ${left}`,
233
- * RightOnly: ({ right }) => `right ${right}`,
234
- * LeftAndRight: ({ left, right }) => `both ${left}/${right}`
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(These.LeftAndRight({ left: 1, right: "a" })),
239
- * "both 1/a"
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 LeftOnly: (args: {
249
- readonly _tag: "LeftOnly";
250
- readonly left: A;
266
+ readonly WarningsOnly: (args: {
267
+ readonly _tag: "WarningsOnly";
268
+ readonly warnings: A;
251
269
  }) => any;
252
- readonly RightOnly: (args: {
253
- readonly _tag: "RightOnly";
254
- readonly right: B;
270
+ readonly SuccessOnly: (args: {
271
+ readonly _tag: "SuccessOnly";
272
+ readonly success: B;
255
273
  }) => any;
256
- readonly LeftAndRight: (args: {
257
- readonly _tag: "LeftAndRight";
258
- readonly left: A;
259
- readonly right: B;
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: "LeftOnly";
263
- readonly left: A;
280
+ readonly _tag: "WarningsOnly";
281
+ readonly warnings: A;
264
282
  } | {
265
- readonly _tag: "RightOnly";
266
- readonly right: B;
283
+ readonly _tag: "SuccessOnly";
284
+ readonly success: B;
267
285
  } | {
268
- readonly _tag: "LeftAndRight";
269
- readonly left: A;
270
- readonly right: B;
271
- }) => effect_Unify.Unify<ReturnType<Cases["LeftOnly" | "RightOnly" | "LeftAndRight"]>>;
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 LeftOnly: (args: {
274
- readonly _tag: "LeftOnly";
275
- readonly left: A;
291
+ readonly WarningsOnly: (args: {
292
+ readonly _tag: "WarningsOnly";
293
+ readonly warnings: A;
276
294
  }) => any;
277
- readonly RightOnly: (args: {
278
- readonly _tag: "RightOnly";
279
- readonly right: B;
295
+ readonly SuccessOnly: (args: {
296
+ readonly _tag: "SuccessOnly";
297
+ readonly success: B;
280
298
  }) => any;
281
- readonly LeftAndRight: (args: {
282
- readonly _tag: "LeftAndRight";
283
- readonly left: A;
284
- readonly right: B;
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: "LeftOnly";
288
- readonly left: A;
305
+ readonly _tag: "WarningsOnly";
306
+ readonly warnings: A;
289
307
  } | {
290
- readonly _tag: "RightOnly";
291
- readonly right: B;
308
+ readonly _tag: "SuccessOnly";
309
+ readonly success: B;
292
310
  } | {
293
- readonly _tag: "LeftAndRight";
294
- readonly left: A;
295
- readonly right: B;
296
- }, cases: Cases): effect_Unify.Unify<ReturnType<Cases["LeftOnly" | "RightOnly" | "LeftAndRight"]>>;
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 `These` that is guaranteed to carry a `left` — either `LeftOnly` or
300
- * `LeftAndRight`.
317
+ * Any `WarnResult` that is guaranteed to carry `warnings` — either `WarningsOnly`
318
+ * or `SuccessWithWarnings`.
301
319
  *
302
320
  * @example
303
321
  * ```ts
304
- * import { These } from "@nunofyobiz/effect-extras"
322
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
305
323
  *
306
- * const value: These.WithLeft<number, string> = These.LeftOnly({ left: 1 })
324
+ * const value: WarnResult.WithWarnings<string, number> = WarnResult.WarningsOnly({
325
+ * warnings: "skipped 2 rows"
326
+ * })
307
327
  *
308
- * assert.deepStrictEqual(value.left, 1)
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 WithLeft<L, R> = LeftOnly<L> | LeftAndRight<L, R>;
334
+ type WithWarnings<W, A> = WarningsOnly<W> | SuccessWithWarnings<W, A>;
315
335
  /**
316
- * Builds a `These` known to carry a `left`, choosing `LeftAndRight` when `right`
317
- * is present and `LeftOnly` otherwise.
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 `left` is mandatory and the `right` is an optional companion:
320
- * pass an absent (`null`/`undefined`) `right` to get a `LeftOnly`, or a present
321
- * one to get a `LeftAndRight`. The return type `WithLeft<L, R>` reflects that a
322
- * `left` is always present.
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 { These } from "@nunofyobiz/effect-extras"
346
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
327
347
  *
328
348
  * assert.deepStrictEqual(
329
- * These.WithLeft({ left: 1, right: "a" }),
330
- * These.LeftAndRight({ left: 1, right: "a" })
349
+ * WarnResult.WithWarnings({ warnings: "w", success: 1 }),
350
+ * WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })
331
351
  * )
332
352
  *
333
353
  * assert.deepStrictEqual(
334
- * These.WithLeft({ left: 1 }),
335
- * These.LeftOnly({ left: 1 })
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 WithLeft: <L, R>({ left, right, }: {
343
- left: L;
344
- right?: R | undefined;
345
- }) => WithLeft<L, R>;
362
+ declare const WithWarnings: <W, A>({ warnings, success, }: {
363
+ warnings: W;
364
+ success?: A | undefined;
365
+ }) => WithWarnings<W, A>;
346
366
  /**
347
- * Any `These` that is guaranteed to carry a `right` — either `RightOnly` or
348
- * `LeftAndRight`.
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 { These } from "@nunofyobiz/effect-extras"
372
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
353
373
  *
354
- * const value: These.WithRight<number, string> = These.RightOnly({ right: "a" })
374
+ * const value: WarnResult.WithSuccess<string, number> = WarnResult.SuccessOnly({
375
+ * success: 1
376
+ * })
355
377
  *
356
- * assert.deepStrictEqual(value.right, "a")
378
+ * assert.deepStrictEqual(value.success, 1)
357
379
  * ```
358
380
  *
359
381
  * @category models
360
382
  * @since 0.0.0
361
383
  */
362
- type WithRight<L, R> = RightOnly<R> | LeftAndRight<L, R>;
384
+ type WithSuccess<W, A> = SuccessOnly<A> | SuccessWithWarnings<W, A>;
363
385
  /**
364
- * Builds a `These` known to carry a `right`, choosing `LeftAndRight` when `left`
365
- * is present and `RightOnly` otherwise.
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 `WithLeft`: the `right` is mandatory and the `left` is an
368
- * optional companion. Pass an absent (`null`/`undefined`) `left` to get a
369
- * `RightOnly`, or a present one to get a `LeftAndRight`. The return type
370
- * `WithRight<L, R>` reflects that a `right` is always present.
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 { These } from "@nunofyobiz/effect-extras"
397
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
375
398
  *
376
399
  * assert.deepStrictEqual(
377
- * These.WithRight({ left: 1, right: "a" }),
378
- * These.LeftAndRight({ left: 1, right: "a" })
400
+ * WarnResult.WithSuccess({ warnings: "w", success: 1 }),
401
+ * WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })
379
402
  * )
380
403
  *
381
404
  * assert.deepStrictEqual(
382
- * These.WithRight({ right: "a" }),
383
- * These.RightOnly({ right: "a" })
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 WithRight: <L, R>({ left, right, }: {
391
- left?: L | undefined;
392
- right: R;
393
- }) => WithRight<L, R>;
413
+ declare const WithSuccess: <W, A>({ warnings, success, }: {
414
+ warnings?: W | undefined;
415
+ success: A;
416
+ }) => WithSuccess<W, A>;
394
417
  /**
395
- * Builds a `These` from a pair of possibly-nullish inputs, wrapping the result in
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(LeftAndRight)` when both are present, `Option.some(LeftOnly)`
399
- * or `Option.some(RightOnly)` when exactly one is present, and `Option.none()`
400
- * when both are nullish. Use it as the total entry point for turning two optional
401
- * values into a `These`.
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 { These } from "@nunofyobiz/effect-extras"
429
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
406
430
  * import { Option } from "effect"
407
431
  *
408
432
  * assert.deepStrictEqual(
409
- * These.optionFromNullables({ left: 1, right: "a" }),
410
- * Option.some(These.LeftAndRight({ left: 1, right: "a" }))
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
- * These.optionFromNullables({ left: 1, right: null }),
415
- * Option.some(These.LeftOnly({ left: 1 }))
438
+ * WarnResult.optionFromNullables({ warnings: "w", success: null }),
439
+ * Option.some(WarnResult.WarningsOnly({ warnings: "w" }))
416
440
  * )
417
441
  *
418
442
  * assert.deepStrictEqual(
419
- * These.optionFromNullables({ left: null, right: undefined }),
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: <L, R>({ left, right, }: {
428
- left?: L | null | undefined;
429
- right?: R | null | undefined;
430
- }) => Option.Option<These<L, R>>;
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 `These` from a pair of possibly-nullish inputs, falling back to the
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 { These } from "@nunofyobiz/effect-extras"
466
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
443
467
  *
444
468
  * assert.deepStrictEqual(
445
- * These.fromNullables({ left: 1, right: "a" }),
446
- * These.LeftAndRight({ left: 1, right: "a" })
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
- * These.fromNullables({
452
- * left: null,
453
- * right: null,
454
- * orElse: () => These.LeftOnly({ left: 0 })
475
+ * WarnResult.fromNullables({
476
+ * warnings: null,
477
+ * success: null,
478
+ * orElse: () => WarnResult.WarningsOnly({ warnings: "none" })
455
479
  * }),
456
- * These.LeftOnly({ left: 0 })
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: <L, R>({ left, right, orElse, }: {
464
- left?: L | null | undefined;
465
- right?: R | null | undefined;
466
- orElse?: () => These<L, R>;
467
- }) => These<L, R>;
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 `These` from the left's perspective, collapsing the three tags into two
470
- * handlers.
493
+ * Folds a `WarnResult` from the warnings' perspective, collapsing the three tags
494
+ * into two handlers.
471
495
  *
472
- * Both `LeftOnly` and `LeftAndRight` carry a `left`, so they route to the `Left`
473
- * handler; only `RightOnly` lacks a `left` and routes to `RightOnly`. Use it when
474
- * you care about the `left` value and treat the right-only case as the exception.
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 { These } from "@nunofyobiz/effect-extras"
503
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
479
504
  *
480
- * const onLeft = These.matchLeft({
481
- * Left: (left: number) => `left ${left}`,
482
- * RightOnly: (right: string) => `right ${right}`
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
- * onLeft(These.LeftAndRight({ left: 1, right: "a" })),
488
- * "left 1"
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 matchLeft: <L, R, A>({ Left, RightOnly, }: {
497
- Left: (left: L) => A;
498
- RightOnly: (right: R) => A;
499
- }) => (these: These<L, R>) => A;
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 `These` from the right's perspective, collapsing the three tags into two
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 `matchLeft`: both `RightOnly` and `LeftAndRight` carry a `right`,
505
- * so they route to the `Right` handler; only `LeftOnly` lacks a `right` and routes
506
- * to `LeftOnly`. Use it when you care about the `right` value and treat the
507
- * left-only case as the exception.
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 { These } from "@nunofyobiz/effect-extras"
543
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
512
544
  *
513
- * const onRight = These.matchRight({
514
- * LeftOnly: (left: number) => `left ${left}`,
515
- * Right: (right: string) => `right ${right}`
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
- * onRight(These.LeftAndRight({ left: 1, right: "a" })),
521
- * "right a"
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 matchRight: <L, R, A>({ LeftOnly, Right, }: {
530
- LeftOnly: (left: L) => A;
531
- Right: (right: R) => A;
532
- }) => (these: These<L, R>) => A;
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 `These` into a guaranteed `LeftAndRight` by filling whichever side
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 `LeftAndRight` passes through unchanged; a `LeftOnly` gains a `right` from
538
- * `orElseRight`; a `RightOnly` gains a `left` from `orElseLeft`. Use it to
539
- * normalise a partial `These` into the both-present shape before reading both
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 { These } from "@nunofyobiz/effect-extras"
582
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
545
583
  *
546
- * const fill = These.orElse({
547
- * orElseLeft: () => 0,
548
- * orElseRight: () => "default"
584
+ * const fill = WarnResult.orElse({
585
+ * orElseWarnings: () => "no warnings",
586
+ * orElseSuccess: () => 0
549
587
  * })
550
588
  *
551
589
  * assert.deepStrictEqual(
552
- * fill(These.LeftOnly({ left: 1 })),
553
- * These.LeftAndRight({ left: 1, right: "default" })
590
+ * fill(WarnResult.WarningsOnly({ warnings: "w" })),
591
+ * WarnResult.SuccessWithWarnings({ warnings: "w", success: 0 })
554
592
  * )
555
593
  * assert.deepStrictEqual(
556
- * fill(These.RightOnly({ right: "a" })),
557
- * These.LeftAndRight({ left: 0, right: "a" })
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: <L2, R2>({ orElseLeft, orElseRight, }: {
565
- orElseLeft: () => L2;
566
- orElseRight: () => R2;
567
- }) => (<L, R>(these: These<L, R>) => LeftAndRight<L | L2, R | R2>);
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 `These` into a `LeftAndRight` whose missing side is filled with
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 `left` and `right` keys (each
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 { These } from "@nunofyobiz/effect-extras"
617
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
580
618
  *
581
619
  * assert.deepStrictEqual(
582
- * These.orUndefined(These.LeftOnly({ left: 1 })),
583
- * These.LeftAndRight({ left: 1, right: undefined })
620
+ * WarnResult.orUndefined(WarnResult.WarningsOnly({ warnings: "w" })),
621
+ * WarnResult.SuccessWithWarnings({ warnings: "w", success: undefined })
584
622
  * )
585
623
  * assert.deepStrictEqual(
586
- * These.orUndefined(These.RightOnly({ right: "a" })),
587
- * These.LeftAndRight({ left: undefined, right: "a" })
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: <L, R>(these: {
595
- readonly _tag: "LeftOnly";
596
- readonly left: L;
632
+ declare const orUndefined: <W, A>(warnResult: {
633
+ readonly _tag: "WarningsOnly";
634
+ readonly warnings: W;
597
635
  } | {
598
- readonly _tag: "RightOnly";
599
- readonly right: R;
636
+ readonly _tag: "SuccessOnly";
637
+ readonly success: A;
600
638
  } | {
601
- readonly _tag: "LeftAndRight";
602
- readonly left: L;
603
- readonly right: R;
639
+ readonly _tag: "SuccessWithWarnings";
640
+ readonly warnings: W;
641
+ readonly success: A;
604
642
  }) => {
605
- readonly _tag: "LeftAndRight";
606
- readonly left: L | undefined;
607
- readonly right: R | undefined;
643
+ readonly _tag: "SuccessWithWarnings";
644
+ readonly warnings: W | undefined;
645
+ readonly success: A | undefined;
608
646
  } & {
609
- _tag: "LeftAndRight";
647
+ _tag: "SuccessWithWarnings";
610
648
  };
611
649
  /**
612
- * Extracts the `left` of a `These`, falling back to `orElseReturn` when no `left`
613
- * is present.
650
+ * Extracts the `warnings` of a `WarnResult`, falling back to `orElseReturn` when
651
+ * no `warnings` are present.
614
652
  *
615
- * `LeftOnly` and `LeftAndRight` return their `left`; `RightOnly` returns the
616
- * result of `orElseReturn`. Use it to read the left side with a default in one
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 { These } from "@nunofyobiz/effect-extras"
659
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
622
660
  *
623
- * const leftOrZero = These.leftOrElse(() => 0)
661
+ * const warningsOrNone = WarnResult.warningsOrElse(() => "no warnings")
624
662
  *
625
- * assert.deepStrictEqual(leftOrZero(These.LeftOnly({ left: 1 })), 1)
626
663
  * assert.deepStrictEqual(
627
- * leftOrZero(These.LeftAndRight({ left: 1, right: "a" })),
628
- * 1
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 leftOrElse: <A>(orElseReturn: () => A) => <L, R>(these: These<L, R>) => L | A;
680
+ declare const warningsOrElse: <Z>(orElseReturn: () => Z) => <W, A>(warnResult: WarnResult<W, A>) => W | Z;
637
681
  /**
638
- * Extracts the `left` of a `These`, returning `undefined` when no `left` is
639
- * present.
682
+ * Extracts the `warnings` of a `WarnResult`, returning `undefined` when no
683
+ * `warnings` are present.
640
684
  *
641
- * A specialisation of `leftOrElse` whose fallback is `undefined`: `LeftOnly` and
642
- * `LeftAndRight` yield their `left`, while `RightOnly` yields `undefined`.
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 { These } from "@nunofyobiz/effect-extras"
691
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
647
692
  *
648
- * assert.deepStrictEqual(These.leftOrUndefined(These.LeftOnly({ left: 1 })), 1)
649
693
  * assert.deepStrictEqual(
650
- * These.leftOrUndefined(These.RightOnly({ right: "a" })),
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 leftOrUndefined: <L, R>(these: {
659
- readonly _tag: "LeftOnly";
660
- readonly left: L;
706
+ declare const warningsOrUndefined: <W, A>(warnResult: {
707
+ readonly _tag: "WarningsOnly";
708
+ readonly warnings: W;
661
709
  } | {
662
- readonly _tag: "RightOnly";
663
- readonly right: R;
710
+ readonly _tag: "SuccessOnly";
711
+ readonly success: A;
664
712
  } | {
665
- readonly _tag: "LeftAndRight";
666
- readonly left: L;
667
- readonly right: R;
668
- }) => L | undefined;
713
+ readonly _tag: "SuccessWithWarnings";
714
+ readonly warnings: W;
715
+ readonly success: A;
716
+ }) => W | undefined;
669
717
  /**
670
- * Extracts the `right` of a `These`, falling back to `orElseReturn` when no
671
- * `right` is present.
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 `leftOrElse`: `RightOnly` and `LeftAndRight` return their
674
- * `right`; `LeftOnly` returns the result of `orElseReturn`.
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 { These } from "@nunofyobiz/effect-extras"
726
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
679
727
  *
680
- * const rightOrDefault = These.rightOrElse(() => "default")
728
+ * const successOrZero = WarnResult.successOrElse(() => 0)
681
729
  *
682
730
  * assert.deepStrictEqual(
683
- * rightOrDefault(These.RightOnly({ right: "a" })),
684
- * "a"
731
+ * successOrZero(WarnResult.SuccessOnly({ success: 1 })),
732
+ * 1
685
733
  * )
686
734
  * assert.deepStrictEqual(
687
- * rightOrDefault(These.LeftOnly({ left: 1 })),
688
- * "default"
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 rightOrElse: <A>(orElseReturn: () => A) => <L, R>(these: These<L, R>) => R | A;
743
+ declare const successOrElse: <Z>(orElseReturn: () => Z) => <W, A>(warnResult: WarnResult<W, A>) => A | Z;
696
744
  /**
697
- * Extracts the `right` of a `These`, returning `undefined` when no `right` is
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 `rightOrElse` whose fallback is `undefined`: `RightOnly` and
701
- * `LeftAndRight` yield their `right`, while `LeftOnly` yields `undefined`.
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 { These } from "@nunofyobiz/effect-extras"
754
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
706
755
  *
707
756
  * assert.deepStrictEqual(
708
- * These.rightOrUndefined(These.RightOnly({ right: "a" })),
709
- * "a"
757
+ * WarnResult.successOrUndefined(WarnResult.SuccessOnly({ success: 1 })),
758
+ * 1
710
759
  * )
711
760
  * assert.deepStrictEqual(
712
- * These.rightOrUndefined(These.LeftOnly({ left: 1 })),
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 rightOrUndefined: <L, R>(these: {
721
- readonly _tag: "LeftOnly";
722
- readonly left: L;
769
+ declare const successOrUndefined: <W, A>(warnResult: {
770
+ readonly _tag: "WarningsOnly";
771
+ readonly warnings: W;
723
772
  } | {
724
- readonly _tag: "RightOnly";
725
- readonly right: R;
773
+ readonly _tag: "SuccessOnly";
774
+ readonly success: A;
726
775
  } | {
727
- readonly _tag: "LeftAndRight";
728
- readonly left: L;
729
- readonly right: R;
730
- }) => R | undefined;
776
+ readonly _tag: "SuccessWithWarnings";
777
+ readonly warnings: W;
778
+ readonly success: A;
779
+ }) => A | undefined;
731
780
  /**
732
- * Extracts the `right` of a `These` as an `Option`.
781
+ * Extracts the `success` value of a `WarnResult` as an `Option`.
733
782
  *
734
- * `RightOnly` and `LeftAndRight` yield `Option.some(right)`; `LeftOnly` yields
735
- * `Option.none()`. Use it when you want to chain the right side through `Option`
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 { These } from "@nunofyobiz/effect-extras"
789
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
741
790
  * import { Option } from "effect"
742
791
  *
743
792
  * assert.deepStrictEqual(
744
- * These.rightOption(These.RightOnly({ right: "a" })),
745
- * Option.some("a")
793
+ * WarnResult.successOption(WarnResult.SuccessOnly({ success: 1 })),
794
+ * Option.some(1)
746
795
  * )
747
796
  * assert.deepStrictEqual(
748
- * These.rightOption(These.LeftOnly({ left: 1 })),
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 rightOption: <L, R>(these: These<L, R>) => Option.Option<R>;
805
+ declare const successOption: <W, A>(warnResult: WarnResult<W, A>) => Option.Option<A>;
757
806
  /**
758
- * Extracts the `left` of a `These` as an `Option`.
807
+ * Extracts the `warnings` of a `WarnResult` as an `Option`.
759
808
  *
760
- * The mirror of `rightOption`: `LeftOnly` and `LeftAndRight` yield
761
- * `Option.some(left)`, while `RightOnly` yields `Option.none()`.
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 { These } from "@nunofyobiz/effect-extras"
814
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
766
815
  * import { Option } from "effect"
767
816
  *
768
817
  * assert.deepStrictEqual(
769
- * These.leftOption(These.LeftOnly({ left: 1 })),
770
- * Option.some(1)
818
+ * WarnResult.warningsOption(WarnResult.WarningsOnly({ warnings: "w" })),
819
+ * Option.some("w")
771
820
  * )
772
821
  * assert.deepStrictEqual(
773
- * These.leftOption(These.RightOnly({ right: "a" })),
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 leftOption: <L, R>(these: These<L, R>) => Option.Option<L>;
830
+ declare const warningsOption: <W, A>(warnResult: WarnResult<W, A>) => Option.Option<W>;
782
831
  /**
783
- * Transforms both sides of a `These`, applying `mapLeft` to any `left` and
784
- * `mapRight` to any `right`.
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 `LeftOnly` maps only
787
- * the left, `RightOnly` only the right, and `LeftAndRight` both. The tag is
788
- * preserved. Use it as the bifunctor map over `These`.
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 { These } from "@nunofyobiz/effect-extras"
842
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
793
843
  *
794
- * const both = These.mapBoth({
795
- * mapLeft: (left: number) => left + 1,
796
- * mapRight: (right: string) => right.toUpperCase()
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(These.LeftAndRight({ left: 1, right: "a" })),
801
- * These.LeftAndRight({ left: 2, right: "A" })
850
+ * both(WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })),
851
+ * WarnResult.SuccessWithWarnings({ warnings: "W", success: 2 })
802
852
  * )
803
853
  * assert.deepStrictEqual(
804
- * both(These.LeftOnly({ left: 1 })),
805
- * These.LeftOnly({ left: 2 })
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: <L1, R1, L2, R2>({ mapLeft, mapRight, }: {
813
- mapLeft: (left: L1) => L2;
814
- mapRight: (right: R1) => R2;
815
- }) => ((these: These<L1, R1>) => These<L2, R2>);
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 `These` inside an `Effect`.
868
+ * reassembling the results into a `WarnResult` inside an `Effect`.
819
869
  *
820
- * For `LeftAndRight` both effects run via `Effect.all` and their results are
821
- * combined; `LeftOnly`/`RightOnly` run only the relevant effect. Errors and
822
- * requirements from both mappers are unioned into the result type. Use it when
823
- * mapping a `These`'s sides requires effects (validation, IO).
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 { These } from "@nunofyobiz/effect-extras"
877
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
828
878
  * import { Effect } from "effect"
829
879
  *
830
- * const both = These.mapBothEffect({
831
- * mapLeft: (left: number) => Effect.succeed(left + 1),
832
- * mapRight: (right: string) => Effect.succeed(right.toUpperCase())
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(both(These.LeftAndRight({ left: 1, right: "a" }))),
837
- * These.LeftAndRight({ left: 2, right: "A" })
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: <L1, R1, L2, R2, EL, ER, RL, RR>({ mapLeft, mapRight, }: {
845
- mapLeft: (left: L1) => Effect.Effect<L2, EL, RL>;
846
- mapRight: (right: R1) => Effect.Effect<R2, ER, RR>;
847
- }) => ((these: These<L1, R1>) => Effect.Effect<These<L2, R2>, EL | ER, RL | RR>);
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 `left` of a `These`, leaving any `right` untouched.
901
+ * Transforms the `warnings` of a `WarnResult`, leaving any `success` value
902
+ * untouched.
850
903
  *
851
- * A specialisation of `mapBoth` with the right mapper set to `identity`:
852
- * `LeftOnly` and `LeftAndRight` have their `left` mapped, while `RightOnly` passes
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 { These } from "@nunofyobiz/effect-extras"
910
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
858
911
  *
859
- * const inc = These.mapLeft((left: number) => left + 1)
912
+ * const shout = WarnResult.mapWarnings((warnings: string) =>
913
+ * warnings.toUpperCase()
914
+ * )
860
915
  *
861
916
  * assert.deepStrictEqual(
862
- * inc(These.LeftAndRight({ left: 1, right: "a" })),
863
- * These.LeftAndRight({ left: 2, right: "a" })
917
+ * shout(WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })),
918
+ * WarnResult.SuccessWithWarnings({ warnings: "W", success: 1 })
864
919
  * )
865
920
  * assert.deepStrictEqual(
866
- * inc(These.RightOnly({ right: "a" })),
867
- * These.RightOnly({ right: "a" })
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 mapLeft: <L1, L2>(mapLeft: (left: L1) => L2) => (<R>(these: These<L1, R>) => These<L2, R>);
929
+ declare const mapWarnings: <W1, W2>(mapWarnings: (warnings: W1) => W2) => (<A>(warnResult: WarnResult<W1, A>) => WarnResult<W2, A>);
875
930
  /**
876
- * Chains the `left` of a `These` into a new `These`, flattening the result.
931
+ * Chains the `warnings` of a `WarnResult` into a new `WarnResult`, flattening the
932
+ * result.
877
933
  *
878
- * Whenever a `left` is present (`LeftOnly` or `LeftAndRight`) it is passed to
879
- * `mapLeft`, whose returned `These` replaces the original; `RightOnly` passes
880
- * through unchanged. Use it to sequence left-driven computations that themselves
881
- * produce a `These`.
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 { These } from "@nunofyobiz/effect-extras"
941
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
886
942
  *
887
- * const chain = These.flatMapLeft((left: number) =>
888
- * left > 0
889
- * ? These.LeftOnly({ left: left * 10 })
890
- * : These.RightOnly({ right: "non-positive" })
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(These.LeftOnly({ left: 2 })),
895
- * These.LeftOnly({ left: 20 })
950
+ * chain(WarnResult.WarningsOnly({ warnings: "w" })),
951
+ * WarnResult.WarningsOnly({ warnings: "W" })
896
952
  * )
897
953
  * assert.deepStrictEqual(
898
- * chain(These.RightOnly({ right: "a" })),
899
- * These.RightOnly({ right: "a" })
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 flatMapLeft: <L1, L2, R2>(mapLeft: (left: L1) => These<L2, R2>) => (<R1>(these: These<L1, R1>) => These<L2, R1 | R2>);
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 `mapLeft`: transforms the `left` of a `These` through an `Effect`,
909
- * leaving any `right` untouched.
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 right mapper set to
912
- * `Effect.succeed`: the `left` (when present) is mapped effectfully and the
913
- * `right` is carried through unchanged.
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 { These } from "@nunofyobiz/effect-extras"
973
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
918
974
  * import { Effect } from "effect"
919
975
  *
920
- * const inc = These.mapLeftEffect((left: number) => Effect.succeed(left + 1))
976
+ * const shout = WarnResult.mapWarningsEffect((warnings: string) =>
977
+ * Effect.succeed(warnings.toUpperCase())
978
+ * )
921
979
  *
922
980
  * assert.deepStrictEqual(
923
- * Effect.runSync(inc(These.LeftAndRight({ left: 1, right: "a" }))),
924
- * These.LeftAndRight({ left: 2, right: "a" })
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 mapLeftEffect: <L1, L2, EL, RL>(mapLeft: (left: L1) => Effect.Effect<L2, EL, RL>) => (<R>(these: These<L1, R>) => Effect.Effect<These<L2, R>, EL, RL>);
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 `flatMapLeft`: chains the `left` of a `These` into an `Effect` that
934
- * yields a new `These`, flattening the result.
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 a `left` is present it is passed to `mapLeft`, whose effectful `These`
937
- * replaces the original; `RightOnly` is lifted unchanged via `Effect.succeed`. Use
938
- * it to sequence left-driven effectful computations that produce a `These`.
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 { These } from "@nunofyobiz/effect-extras"
1003
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
943
1004
  * import { Effect } from "effect"
944
1005
  *
945
- * const chain = These.flatMapLeftEffect((left: number) =>
946
- * Effect.succeed(These.LeftOnly({ left: left * 10 }))
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(These.LeftOnly({ left: 2 }))),
951
- * These.LeftOnly({ left: 20 })
1011
+ * Effect.runSync(chain(WarnResult.WarningsOnly({ warnings: "w" }))),
1012
+ * WarnResult.WarningsOnly({ warnings: "W" })
952
1013
  * )
953
1014
  * assert.deepStrictEqual(
954
- * Effect.runSync(chain(These.RightOnly({ right: "a" }))),
955
- * These.RightOnly({ right: "a" })
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 flatMapLeftEffect: <L1, L2, R2, EL, RL>(mapLeft: (left: L1) => Effect.Effect<These<L2, R2>, EL, RL>) => (<R1>(these: These<L1, R1>) => Effect.Effect<These<L2, R1 | R2>, EL, RL>);
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 `right` of a `These`, leaving any `left` untouched.
1025
+ * Transforms the `success` value of a `WarnResult`, leaving any `warnings`
1026
+ * untouched.
965
1027
  *
966
- * The mirror of `mapLeft`: `RightOnly` and `LeftAndRight` have their `right`
967
- * mapped, while `LeftOnly` passes through unchanged.
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 { These } from "@nunofyobiz/effect-extras"
1033
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
972
1034
  *
973
- * const upper = These.mapRight((right: string) => right.toUpperCase())
1035
+ * const inc = WarnResult.mapSuccess((success: number) => success + 1)
974
1036
  *
975
1037
  * assert.deepStrictEqual(
976
- * upper(These.LeftAndRight({ left: 1, right: "a" })),
977
- * These.LeftAndRight({ left: 1, right: "A" })
1038
+ * inc(WarnResult.SuccessWithWarnings({ warnings: "w", success: 1 })),
1039
+ * WarnResult.SuccessWithWarnings({ warnings: "w", success: 2 })
978
1040
  * )
979
1041
  * assert.deepStrictEqual(
980
- * upper(These.LeftOnly({ left: 1 })),
981
- * These.LeftOnly({ left: 1 })
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 mapRight: <R1, R2>(mapRight: (right: R1) => R2) => (<L>(these: These<L, R1>) => These<L, R2>);
1050
+ declare const mapSuccess: <A1, A2>(mapSuccess: (success: A1) => A2) => (<W>(warnResult: WarnResult<W, A1>) => WarnResult<W, A2>);
989
1051
  /**
990
- * Chains the `right` of a `These` into a new `These`, flattening the result.
1052
+ * Chains the `success` value of a `WarnResult` into a new `WarnResult`, flattening
1053
+ * the result.
991
1054
  *
992
- * The mirror of `flatMapLeft`: whenever a `right` is present (`RightOnly` or
993
- * `LeftAndRight`) it is passed to `mapRight`, whose returned `These` replaces the
994
- * original; `LeftOnly` passes through unchanged.
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 { These } from "@nunofyobiz/effect-extras"
1062
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
999
1063
  *
1000
- * const chain = These.flatMapRight((right: string) =>
1001
- * These.RightOnly({ right: right.toUpperCase() })
1064
+ * const chain = WarnResult.flatMapSuccess((success: number) =>
1065
+ * WarnResult.SuccessOnly({ success: success + 1 })
1002
1066
  * )
1003
1067
  *
1004
1068
  * assert.deepStrictEqual(
1005
- * chain(These.RightOnly({ right: "a" })),
1006
- * These.RightOnly({ right: "A" })
1069
+ * chain(WarnResult.SuccessOnly({ success: 1 })),
1070
+ * WarnResult.SuccessOnly({ success: 2 })
1007
1071
  * )
1008
1072
  * assert.deepStrictEqual(
1009
- * chain(These.LeftOnly({ left: 1 })),
1010
- * These.LeftOnly({ left: 1 })
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 flatMapRight: <L2, R1, R2>(mapRight: (right: R1) => These<L2, R2>) => (<L1>(these: These<L1, R1>) => These<L1 | L2, R2>);
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 `mapRight`: transforms the `right` of a `These` through an `Effect`,
1020
- * leaving any `left` untouched.
1083
+ * Effectful `mapSuccess`: transforms the `success` value of a `WarnResult` through
1084
+ * an `Effect`, leaving any `warnings` untouched.
1021
1085
  *
1022
- * The mirror of `mapLeftEffect`: the `right` (when present) is mapped effectfully
1023
- * and the `left` is carried through unchanged via `Effect.succeed`.
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 { These } from "@nunofyobiz/effect-extras"
1092
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
1028
1093
  * import { Effect } from "effect"
1029
1094
  *
1030
- * const upper = These.mapRightEffect((right: string) =>
1031
- * Effect.succeed(right.toUpperCase())
1095
+ * const inc = WarnResult.mapSuccessEffect((success: number) =>
1096
+ * Effect.succeed(success + 1)
1032
1097
  * )
1033
1098
  *
1034
1099
  * assert.deepStrictEqual(
1035
- * Effect.runSync(upper(These.LeftAndRight({ left: 1, right: "a" }))),
1036
- * These.LeftAndRight({ left: 1, right: "A" })
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 mapRightEffect: <R1, R2, ER, RR>(mapRight: (right: R1) => Effect.Effect<R2, ER, RR>) => (<L>(these: These<L, R1>) => Effect.Effect<These<L, R2>, ER, RR>);
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 `flatMapRight`: chains the `right` of a `These` into an `Effect` that
1046
- * yields a new `These`, flattening the result.
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 `flatMapLeftEffect`: when a `right` is present it is passed to
1049
- * `mapRight`, whose effectful `These` replaces the original; `LeftOnly` is lifted
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 { These } from "@nunofyobiz/effect-extras"
1121
+ * import { WarnResult } from "@nunofyobiz/effect-extras"
1055
1122
  * import { Effect } from "effect"
1056
1123
  *
1057
- * const chain = These.flatMapRightEffect((right: string) =>
1058
- * Effect.succeed(These.RightOnly({ right: right.toUpperCase() }))
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(These.RightOnly({ right: "a" }))),
1063
- * These.RightOnly({ right: "A" })
1129
+ * Effect.runSync(chain(WarnResult.SuccessOnly({ success: 1 }))),
1130
+ * WarnResult.SuccessOnly({ success: 2 })
1064
1131
  * )
1065
1132
  * assert.deepStrictEqual(
1066
- * Effect.runSync(chain(These.LeftOnly({ left: 1 }))),
1067
- * These.LeftOnly({ left: 1 })
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 flatMapRightEffect: <L2, R1, R2, ER, RR>(mapRight: (right: R1) => Effect.Effect<These<L2, R2>, ER, RR>) => (<L1>(these: These<L1, R1>) => Effect.Effect<These<L1 | L2, R2>, ER, RR>);
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 These$1_LeftAndRight: typeof LeftAndRight;
1077
- declare const These$1_LeftOnly: typeof LeftOnly;
1078
- declare const These$1_RightOnly: typeof RightOnly;
1079
- type These$1_These<L, R> = These<L, R>;
1080
- declare const These$1_WithLeft: typeof WithLeft;
1081
- declare const These$1_WithRight: typeof WithRight;
1082
- declare const These$1_flatMapLeft: typeof flatMapLeft;
1083
- declare const These$1_flatMapLeftEffect: typeof flatMapLeftEffect;
1084
- declare const These$1_flatMapRight: typeof flatMapRight;
1085
- declare const These$1_flatMapRightEffect: typeof flatMapRightEffect;
1086
- declare const These$1_fromNullables: typeof fromNullables;
1087
- declare const These$1_is: typeof is;
1088
- declare const These$1_leftOption: typeof leftOption;
1089
- declare const These$1_leftOrElse: typeof leftOrElse;
1090
- declare const These$1_leftOrUndefined: typeof leftOrUndefined;
1091
- declare const These$1_mapBoth: typeof mapBoth;
1092
- declare const These$1_mapBothEffect: typeof mapBothEffect;
1093
- declare const These$1_mapLeft: typeof mapLeft;
1094
- declare const These$1_mapLeftEffect: typeof mapLeftEffect;
1095
- declare const These$1_mapRight: typeof mapRight;
1096
- declare const These$1_mapRightEffect: typeof mapRightEffect;
1097
- declare const These$1_matchLeft: typeof matchLeft;
1098
- declare const These$1_matchRight: typeof matchRight;
1099
- declare const These$1_optionFromNullables: typeof optionFromNullables;
1100
- declare const These$1_orElse: typeof orElse;
1101
- declare const These$1_orUndefined: typeof orUndefined;
1102
- declare const These$1_rightOption: typeof rightOption;
1103
- declare const These$1_rightOrElse: typeof rightOrElse;
1104
- declare const These$1_rightOrUndefined: typeof rightOrUndefined;
1105
- declare namespace These$1 {
1106
- export { These$1_LeftAndRight as LeftAndRight, These$1_LeftOnly as LeftOnly, These$1_RightOnly as RightOnly, type These$1_These as These, These$1_WithLeft as WithLeft, These$1_WithRight as WithRight, These$1_flatMapLeft as flatMapLeft, These$1_flatMapLeftEffect as flatMapLeftEffect, These$1_flatMapRight as flatMapRight, These$1_flatMapRightEffect as flatMapRightEffect, These$1_fromNullables as fromNullables, These$1_is as is, These$1_leftOption as leftOption, These$1_leftOrElse as leftOrElse, These$1_leftOrUndefined as leftOrUndefined, These$1_mapBoth as mapBoth, These$1_mapBothEffect as mapBothEffect, These$1_mapLeft as mapLeft, These$1_mapLeftEffect as mapLeftEffect, These$1_mapRight as mapRight, These$1_mapRightEffect as mapRightEffect, match$1 as match, These$1_matchLeft as matchLeft, These$1_matchRight as matchRight, These$1_optionFromNullables as optionFromNullables, These$1_orElse as orElse, These$1_orUndefined as orUndefined, These$1_rightOption as rightOption, These$1_rightOrElse as rightOrElse, These$1_rightOrUndefined as rightOrUndefined };
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 `These` for each index so that
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. At each index `f` receives a `These.These<A, B>`:
1145
- * `LeftAndRight` when both arrays have an element, `LeftOnly` when only the
1146
- * first does, and `RightOnly` when only the second does. Use it when the
1147
- * "extra" tail of either array still carries meaning.
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, These } from "@nunofyobiz/effect-extras"
1220
+ * import { ArrayX, WarnResult } from "@nunofyobiz/effect-extras"
1152
1221
  *
1153
- * const describe = These.match({
1154
- * LeftOnly: ({ left }) => `left ${left}`,
1155
- * RightOnly: ({ right }) => `right ${right}`,
1156
- * LeftAndRight: ({ left, right }) => `both ${left}/${right}`,
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.zipWithThese([1, 2, 3], [10, 20], describe), [
1228
+ * assert.deepStrictEqual(ArrayX.zipWithWarnings([1, 2, 3], [10, 20], describe), [
1160
1229
  * "both 1/10",
1161
1230
  * "both 2/20",
1162
- * "left 3",
1231
+ * "warnings 3",
1163
1232
  * ])
1164
1233
  * ```
1165
1234
  *
1166
1235
  * @category combinators
1167
1236
  * @since 0.0.0
1168
1237
  */
1169
- declare const zipWithThese: (<A, B, C>(f: (ab: These<A, B>) => C) => (array1: readonly A[], array2: readonly B[]) => C[]) & (<A, B, C>(array1: readonly A[], array2: readonly B[], f: (ab: These<A, B>) => C) => C[]);
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 ArrayX_zipWithThese: typeof zipWithThese;
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, ArrayX_zipWithThese as zipWithThese };
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, These$1 as These, fromNullableOrThrow as nn };
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 };