unthrown 0.3.0 → 1.1.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.cts CHANGED
@@ -1,4 +1,20 @@
1
1
  //#region src/types.d.ts
2
+ /**
3
+ * Flatten an intersection into a single object literal so accumulated `bind` /
4
+ * `let` scopes display cleanly (`{ a; b }` rather than `{ a } & { b }`).
5
+ *
6
+ * @internal
7
+ */
8
+ type Prettify<T> = { [K in keyof T]: T[K] } & {};
9
+ /**
10
+ * The scope produced by a `bind` / `let` step: `T` with `K` added (as a readonly
11
+ * property of type `U`). `Omit<T, K>` first drops any existing `K`, so re-binding
12
+ * a name **overwrites** it — matching the runtime spread — rather than producing
13
+ * an unsound `T[K] & U` intersection.
14
+ *
15
+ * @internal
16
+ */
17
+ type Bound<T, K extends string, U> = Prettify<Omit<T, K> & { readonly [P in K]: U }>;
2
18
  /**
3
19
  * The method surface every {@link Result} variant carries. Factored out so the
4
20
  * three variants ({@link OkView}, {@link ErrView}, {@link DefectView}) can each
@@ -56,6 +72,41 @@ type ResultMethods<T, E> = {
56
72
  * @param f - the failable side effect; its `Ok` value is ignored.
57
73
  */
58
74
  flatTap<E2>(f: (value: T) => Result$1<unknown, E2>): Result$1<T, E | E2>;
75
+ /**
76
+ * Do-notation: run `f` for a `Result` and **bind its value** under `name` in
77
+ * an accumulating object scope.
78
+ *
79
+ * @remarks
80
+ * Begin a chain with {@link Do} (an empty object scope) and grow it step by
81
+ * step. `f` receives the scope accumulated so far and returns a `Result`; on
82
+ * `Ok` the value is added as `{ ...scope, [name]: value }`, on `Err`/`Defect`
83
+ * the chain short-circuits. Errors union (`E | E2`). A throw becomes a
84
+ * `Defect` — as does calling `bind` on a non-object scope (e.g. `Ok(5).bind`),
85
+ * which is misuse: the scope is always an object inside a real `Do()` chain.
86
+ * (`let` is the pure-value counterpart.)
87
+ *
88
+ * @typeParam K - the key the bound value is stored under.
89
+ * @typeParam U - the bound value type.
90
+ * @typeParam E2 - the error type `f` may introduce.
91
+ * @param name - the scope key.
92
+ * @param f - produces a `Result` from the accumulated scope.
93
+ */
94
+ bind<K extends string, U, E2>(name: K, f: (scope: T) => Result$1<U, E2>): Result$1<Bound<T, K, U>, E | E2>;
95
+ /**
96
+ * Do-notation: run `f` for a **plain value** and bind it under `name` in the
97
+ * accumulating object scope. The pure-value counterpart of {@link ResultMethods.bind | bind}.
98
+ *
99
+ * @remarks
100
+ * `f` receives the scope and returns a value (not a `Result`); it is added as
101
+ * `{ ...scope, [name]: value }`. Runs only on `Ok`; `Err`/`Defect` pass
102
+ * through. A throw becomes a `Defect`.
103
+ *
104
+ * @typeParam K - the key the value is stored under.
105
+ * @typeParam U - the value type.
106
+ * @param name - the scope key.
107
+ * @param f - computes a value from the accumulated scope.
108
+ */
109
+ let<K extends string, U>(name: K, f: (scope: T) => U): Result$1<Bound<T, K, U>, E>;
59
110
  /**
60
111
  * Replace the success value with a constant `value`.
61
112
  *
@@ -107,18 +158,35 @@ type ResultMethods<T, E> = {
107
158
  * @param f - the side effect (its return value is ignored).
108
159
  */
109
160
  tapErr(f: (error: E) => void): Result$1<T, E>;
161
+ /**
162
+ * Run a **failable** side effect on the error, keeping the original error but
163
+ * threading the effect's own error.
164
+ *
165
+ * @remarks
166
+ * The error-channel mirror of {@link ResultMethods.flatTap | flatTap}: `f`
167
+ * returns a `Result`, but its **success value is discarded** — on the effect's
168
+ * `Ok` the original `Err` flows through unchanged, while an `Err` (or `Defect`)
169
+ * from `f` short-circuits and threads its error (`Result<T, E | E2>`). Runs only
170
+ * on `Err`; `Ok` and `Defect` pass through. If `f` throws, the throw becomes a
171
+ * `Defect`. Use it for a failable effect _during_ error handling (e.g. writing
172
+ * the error to an audit log that may itself fail).
173
+ *
174
+ * @typeParam E2 - the error type the effect may introduce.
175
+ * @param f - the failable side effect; its `Ok` value is ignored.
176
+ */
177
+ flatTapErr<E2>(f: (error: E) => Result$1<unknown, E2>): Result$1<T, E | E2>;
110
178
  /**
111
179
  * Recover from a `Defect` — the **only** combinator that can touch one.
112
180
  *
113
181
  * @remarks
114
182
  * Runs `f` only when a `Defect` is present, re-entering the modeled world by
115
183
  * returning a `Result` (an `Ok` or a fresh `Err`). `Ok` and `Err` pass
116
- * through. Recovering a defect should be rare: usually you let it bubble to
184
+ * through. Recovering a Defect should be rare: usually you let it bubble to
117
185
  * the edge. If `f` throws, the throw becomes a new `Defect`.
118
186
  *
119
187
  * @typeParam U - a success type the recovery may produce.
120
188
  * @typeParam E2 - an error type the recovery may produce.
121
- * @param f - maps the defect's unknown cause to a recovering `Result`.
189
+ * @param f - maps the Defect's unknown cause to a recovering `Result`.
122
190
  */
123
191
  recoverDefect<U, E2>(f: (cause: unknown) => Result$1<U, E2>): Result$1<T | U, E | E2>;
124
192
  /**
@@ -132,9 +200,9 @@ type ResultMethods<T, E> = {
132
200
  * Exhaustively fold all three runtime states into a single value of type `R`.
133
201
  *
134
202
  * @remarks
135
- * Exactly one handler runs. Together with the throw-to-defect guarantee, this
203
+ * Exactly one handler runs. Together with the throw-to-Defect guarantee, this
136
204
  * is typically the single place a pipeline is handled at the edge — mapping
137
- * `ok`/`err`/`defect` to (for example) 2xx / 4xx / 5xx with no `try`/`catch`.
205
+ * `Ok`/`Err`/`Defect` to (for example) 2xx / 4xx / 5xx with no `try`/`catch`.
138
206
  * (For richer matching, a `Result` is also a discriminated union — branch on
139
207
  * its `tag` property, e.g. with `ts-pattern`.)
140
208
  *
@@ -152,7 +220,7 @@ type ResultMethods<T, E> = {
152
220
  * @returns the `Ok` value.
153
221
  * @throws On `Err`, an {@link UnwrapError} carrying the error. On a `Defect`,
154
222
  * re-throws the **original cause** with its original stack, so an unhandled
155
- * defect surfaces at the global handler as the real failure.
223
+ * Defect surfaces at the global handler as the real failure.
156
224
  */
157
225
  unwrap(): T;
158
226
  /**
@@ -167,7 +235,7 @@ type ResultMethods<T, E> = {
167
235
  * The success value, or `fallback` on `Err`.
168
236
  *
169
237
  * @param fallback - returned when the result is an `Err`.
170
- * @throws Re-throws on a `Defect` — a defect is a bug, not an absent value, so
238
+ * @throws Re-throws on a `Defect` — a Defect is a bug, not an absent value, so
171
239
  * it is never silently replaced.
172
240
  */
173
241
  unwrapOr(fallback: T): T;
@@ -220,7 +288,7 @@ type DefectView<T = never, E = never> = ResultMethods<T, E> & {
220
288
  *
221
289
  * - **`Ok`** — a success carrying a `value: T`.
222
290
  * - **`Err`** — a modeled, anticipated failure carrying an `error: E`.
223
- * - **`Defect`** — an *unmodeled* failure carrying an unknown `cause`. A defect
291
+ * - **`Defect`** — an *unmodeled* failure carrying an unknown `cause`. A Defect
224
292
  * never appears in `E`; it is the library's third, out-of-band channel.
225
293
  *
226
294
  * Because it is a real union, you can match it natively (a `switch` on `tag`, or
@@ -234,10 +302,10 @@ type DefectView<T = never, E = never> = ResultMethods<T, E> & {
234
302
  *
235
303
  * @example
236
304
  * ```ts
237
- * import { ok, err, type Result } from "unthrown";
305
+ * import { Ok, Err, type Result } from "unthrown";
238
306
  *
239
307
  * function half(n: number): Result<number, "odd"> {
240
- * return n % 2 === 0 ? ok(n / 2) : err("odd");
308
+ * return n % 2 === 0 ? Ok(n / 2) : Err("odd");
241
309
  * }
242
310
  *
243
311
  * const message = half(10).match({
@@ -296,12 +364,25 @@ type AsyncResult<T, E> = Awaitable<Result$1<T, E>> & {
296
364
  * may return a `Result` **or** an `AsyncResult`; its `Ok` value is discarded,
297
365
  * an `Err`/`Defect` short-circuits, and a throw becomes a `Defect`.
298
366
  */
299
- flatTap<E2>(f: (value: T) => Result$1<unknown, E2> | AsyncResult<unknown, E2>): AsyncResult<T, E | E2>; /** Asynchronous `as`. */
367
+ flatTap<E2>(f: (value: T) => Result$1<unknown, E2> | AsyncResult<unknown, E2>): AsyncResult<T, E | E2>;
368
+ /**
369
+ * Asynchronous `bind` (do-notation). `f` may return a `Result` **or** an
370
+ * `AsyncResult`; its value is bound under `name` in the accumulating scope.
371
+ */
372
+ bind<K extends string, U, E2>(name: K, f: (scope: T) => Result$1<U, E2> | AsyncResult<U, E2>): AsyncResult<Bound<T, K, U>, E | E2>; /** Asynchronous `let` (do-notation). `f` returns a plain value, bound under `name`. */
373
+ let<K extends string, U>(name: K, f: (scope: T) => U): AsyncResult<Bound<T, K, U>, E>; /** Asynchronous `as`. */
300
374
  as<U>(value: U): AsyncResult<U, E>; /** Asynchronous `mapErr`. `f` is synchronous; a throw becomes a `Defect`. */
301
375
  mapErr<E2>(f: (error: E) => E2): AsyncResult<T, E2>; /** Asynchronous `orElse`. `f` may return a `Result` or an `AsyncResult`. */
302
376
  orElse<U, E2>(f: (error: E) => Result$1<U, E2> | AsyncResult<U, E2>): AsyncResult<T | U, E2>; /** Asynchronous `recover`. `f` is synchronous; a throw becomes a `Defect`. */
303
377
  recover<U>(f: (error: E) => U): AsyncResult<T | U, never>; /** Asynchronous `tapErr`. `f` is synchronous; a throw becomes a `Defect`. */
304
- tapErr(f: (error: E) => void): AsyncResult<T, E>; /** Asynchronous `recoverDefect`. `f` may return a `Result` or an `AsyncResult`. */
378
+ tapErr(f: (error: E) => void): AsyncResult<T, E>;
379
+ /**
380
+ * Asynchronous `flatTapErr` — a failable tap on the error that keeps the
381
+ * original error. `f` may return a `Result` **or** an `AsyncResult`; its `Ok`
382
+ * value is discarded, an `Err`/`Defect` from `f` threads through, and a throw
383
+ * becomes a `Defect`.
384
+ */
385
+ flatTapErr<E2>(f: (error: E) => Result$1<unknown, E2> | AsyncResult<unknown, E2>): AsyncResult<T, E | E2>; /** Asynchronous `recoverDefect`. `f` may return a `Result` or an `AsyncResult`. */
305
386
  recoverDefect<U, E2>(f: (cause: unknown) => Result$1<U, E2> | AsyncResult<U, E2>): AsyncResult<T | U, E | E2>; /** Asynchronous `tapDefect`. */
306
387
  tapDefect(f: (cause: unknown) => void): AsyncResult<T, E>; /** Asynchronous `match`. Handlers are synchronous; resolves to `R`. */
307
388
  match<R>(cases: {
@@ -356,11 +437,11 @@ type AsyncErrOf<R> = R extends AsyncResult<unknown, infer E> ? E : never;
356
437
  *
357
438
  * @example
358
439
  * ```ts
359
- * import { ok } from "unthrown";
360
- * ok(42).unwrap(); // 42
440
+ * import { Ok } from "unthrown";
441
+ * Ok(42).unwrap(); // 42
361
442
  * ```
362
443
  */
363
- declare function ok<T>(value: T): Result$1<T, never>;
444
+ declare function Ok<T>(value: T): Result$1<T, never>;
364
445
  /**
365
446
  * Construct a failed {@link Result} carrying a **modeled** error.
366
447
  *
@@ -369,11 +450,11 @@ declare function ok<T>(value: T): Result$1<T, never>;
369
450
  *
370
451
  * @example
371
452
  * ```ts
372
- * import { err } from "unthrown";
373
- * err("not_found").unwrapErr(); // "not_found"
453
+ * import { Err } from "unthrown";
454
+ * Err("not_found").unwrapErr(); // "not_found"
374
455
  * ```
375
456
  */
376
- declare function err<E>(error: E): Result$1<never, E>;
457
+ declare function Err<E>(error: E): Result$1<never, E>;
377
458
  /**
378
459
  * Type guard: narrow a {@link Result} to its `Ok` variant, exposing `.value`.
379
460
  *
@@ -420,6 +501,19 @@ declare class UnwrapError<E = unknown> extends Error {
420
501
  readonly error: E;
421
502
  constructor(error: E);
422
503
  }
504
+ /**
505
+ * Type guard: is `x` a {@link Result} (any of `Ok` / `Err` / `Defect`)?
506
+ *
507
+ * @remarks
508
+ * Unlike {@link isOk} / {@link isErr} / {@link isDefect}, which narrow a value
509
+ * already known to be a `Result`, this narrows from `unknown` — useful at an
510
+ * untyped boundary. It checks the value carries the `Result` prototype, so a
511
+ * look-alike plain object (`{ tag: "Ok" }`) is **not** matched. An `AsyncResult`
512
+ * is not a `Result` and returns `false`.
513
+ *
514
+ * @returns `true` when `x` is a `Result` produced by this library.
515
+ */
516
+ declare function isResult(x: unknown): x is Result$1<unknown, unknown>;
423
517
  //#endregion
424
518
  //#region src/defect.d.ts
425
519
  declare const DEFECT: unique symbol;
@@ -429,7 +523,7 @@ declare const DEFECT: unique symbol;
429
523
  * @remarks
430
524
  * `qualify` (passed to {@link fromPromise} / {@link fromThrowable}) returns
431
525
  * `E | Defect`: either a modeled domain error, or a `Defect` produced by
432
- * {@link defect} to say "this failure is not modeled". A `Defect` is opaque —
526
+ * {@link Defect} to say "this failure is not modeled". A `Defect` is opaque —
433
527
  * it carries the original cause for the boundary to convert into the third
434
528
  * runtime state of a `Result`.
435
529
  */
@@ -442,18 +536,43 @@ type Defect = {
442
536
  * function when a failure is **not** a modeled domain error.
443
537
  *
444
538
  * @param cause - the original thrown/rejected value.
445
- * @returns an opaque defect marker carrying `cause`.
539
+ * @returns an opaque Defect marker carrying `cause`.
446
540
  *
447
541
  * @example
448
542
  * ```ts
449
- * import { fromPromise, defect } from "unthrown";
543
+ * import { fromPromise, Defect } from "unthrown";
450
544
  *
451
545
  * const user = fromPromise(fetchUser(id), (cause) =>
452
- * cause instanceof NotFoundError ? cause : defect(cause),
546
+ * cause instanceof NotFoundError ? cause : Defect(cause),
453
547
  * );
454
548
  * ```
455
549
  */
456
- declare function defect(cause: unknown): Defect;
550
+ declare function Defect(cause: unknown): Defect;
551
+ //#endregion
552
+ //#region src/do.d.ts
553
+ /**
554
+ * Start a do-notation chain with an empty object scope, grown step by step with
555
+ * `bind` (for `Result`-returning steps) and `let` (for pure values).
556
+ *
557
+ * @remarks
558
+ * Capitalised because `do` is a reserved word. Each step receives the scope
559
+ * accumulated so far; the error types union across `bind`s, and a throw in any
560
+ * step becomes a `Defect`. To go asynchronous, lift the chain with `toAsync()`
561
+ * (then a `bind` may return an `AsyncResult`).
562
+ *
563
+ * @example
564
+ * ```ts
565
+ * import { Do, Ok } from "unthrown";
566
+ *
567
+ * const result = Do()
568
+ * .bind("user", () => findUser(id)) // Result<User, NotFound>
569
+ * .bind("org", ({ user }) => findOrg(user.orgId)) // Result<Org, NotFound>
570
+ * .let("label", ({ user, org }) => `${user.name} @ ${org.name}`)
571
+ * .map(({ user, org, label }) => render(user, org, label));
572
+ * // Result<View, NotFound>
573
+ * ```
574
+ */
575
+ declare function Do(): Result$1<{}, never>;
457
576
  //#endregion
458
577
  //#region src/interop.d.ts
459
578
  /**
@@ -461,7 +580,7 @@ declare function defect(cause: unknown): Defect;
461
580
  * `Err`. The sanctioned alternative to an `Option` type.
462
581
  *
463
582
  * @remarks
464
- * `null` and `undefined` map to `err(onAbsent())`; any other value (including
583
+ * `null` and `undefined` map to `Err(onAbsent())`; any other value (including
465
584
  * falsy ones like `0`, `""`, `false`) maps to `Ok`.
466
585
  *
467
586
  * @typeParam T - the (nullable) value type.
@@ -482,14 +601,14 @@ declare function fromNullable<T, E>(value: T | null | undefined, onAbsent: () =>
482
601
  *
483
602
  * @remarks
484
603
  * `qualify` **must** triage every thrown cause into a modeled error `E` or a
485
- * {@link Defect} (via {@link defect}) — there is no path that leaves `unknown`
604
+ * {@link Defect} (via {@link Defect}) — there is no path that leaves `unknown`
486
605
  * in `E`. A throw inside `qualify` itself is treated as a `Defect`.
487
606
  *
488
607
  * The modeled error type is `Exclude<R, Defect>` — the `Defect` arm of
489
608
  * `qualify`'s return is **subtracted** from `E`, never inferred into it. So a
490
- * `qualify` that returns *only* `defect(cause)` yields `E = never` (a defect is
609
+ * `qualify` that returns *only* `Defect(cause)` yields `E = never` (a Defect is
491
610
  * out-of-band and must not pollute the error channel); reach for
492
- * {@link fromSafePromise} when every failure is a defect.
611
+ * {@link fromSafePromise} when every failure is a Defect.
493
612
  *
494
613
  * @typeParam A - the wrapped function's argument tuple.
495
614
  * @typeParam T - the wrapped function's return type.
@@ -501,8 +620,8 @@ declare function fromNullable<T, E>(value: T | null | undefined, onAbsent: () =>
501
620
  *
502
621
  * @example
503
622
  * ```ts
504
- * import { fromThrowable, defect } from "unthrown";
505
- * const parse = fromThrowable(JSON.parse, (cause) => defect(cause));
623
+ * import { fromThrowable, Defect } from "unthrown";
624
+ * const parse = fromThrowable(JSON.parse, (cause) => Defect(cause));
506
625
  * parse("{}").unwrap();
507
626
  * ```
508
627
  */
@@ -519,8 +638,8 @@ declare function fromThrowable<A extends unknown[], T, R>(fn: (...args: A) => T,
519
638
  *
520
639
  * The modeled error type is `Exclude<R, Defect>` — the `Defect` arm of
521
640
  * `qualify`'s return is **subtracted** from `E`, never inferred into it. So a
522
- * `qualify` that returns *only* `defect(cause)` yields `E = never`; when every
523
- * rejection is a defect, prefer {@link fromSafePromise}.
641
+ * `qualify` that returns *only* `Defect(cause)` yields `E = never`; when every
642
+ * rejection is a Defect, prefer {@link fromSafePromise}.
524
643
  *
525
644
  * @typeParam T - the resolved value type.
526
645
  * @typeParam R - `qualify`'s return type; the modeled error `E` is
@@ -530,9 +649,9 @@ declare function fromThrowable<A extends unknown[], T, R>(fn: (...args: A) => T,
530
649
  *
531
650
  * @example
532
651
  * ```ts
533
- * import { fromPromise, defect } from "unthrown";
652
+ * import { fromPromise, Defect } from "unthrown";
534
653
  * const user = await fromPromise(fetchUser(id), (cause) =>
535
- * cause instanceof NotFoundError ? ("not_found" as const) : defect(cause),
654
+ * cause instanceof NotFoundError ? ("not_found" as const) : Defect(cause),
536
655
  * );
537
656
  * ```
538
657
  */
@@ -579,16 +698,16 @@ type AsyncResultRecord = Record<string, AsyncResult<unknown, unknown>>;
579
698
  * @remarks
580
699
  * Short-circuits on the **first** `Err` (later entries are not inspected for
581
700
  * their error); any `Defect` present **dominates**, winning even over an earlier
582
- * `Err`. A **fixed tuple** keeps its positional types — `all([ok(1), ok("a")])`
701
+ * `Err`. A **fixed tuple** keeps its positional types — `all([Ok(1), Ok("a")])`
583
702
  * is `Result<[number, string], …>` — while a **dynamic array** `Result<T, E>[]`
584
703
  * collapses to `Result<T[], E>` with no cast. For a **record** keyed by name,
585
704
  * use {@link allFromDict}.
586
705
  *
587
706
  * @example
588
707
  * ```ts
589
- * import { all, ok } from "unthrown";
590
- * all([ok(1), ok("a"), ok(true)]).unwrap(); // [1, "a", true] (typed [number, string, boolean])
591
- * all([ok(1), ok(2)] as Result<number, never>[]).unwrap(); // number[]
708
+ * import { all, Ok } from "unthrown";
709
+ * all([Ok(1), Ok("a"), Ok(true)]).unwrap(); // [1, "a", true] (typed [number, string, boolean])
710
+ * all([Ok(1), Ok(2)] as Result<number, never>[]).unwrap(); // number[]
592
711
  * ```
593
712
  */
594
713
  declare function all<Rs extends readonly Result$1<unknown, unknown>[]>(results: readonly [...Rs]): Result$1<AllOk<Rs, { [K in keyof Rs]: OkOf<Rs[K]> }>, ErrOf<Rs[number]>>;
@@ -604,8 +723,8 @@ declare function all<Rs extends readonly Result$1<unknown, unknown>[]>(results:
604
723
  *
605
724
  * @example
606
725
  * ```ts
607
- * import { allFromDict, ok } from "unthrown";
608
- * allFromDict({ id: ok(1), name: ok("ada") }).unwrap(); // { id: 1, name: "ada" }
726
+ * import { allFromDict, Ok } from "unthrown";
727
+ * allFromDict({ id: Ok(1), name: Ok("ada") }).unwrap(); // { id: 1, name: "ada" }
609
728
  * ```
610
729
  */
611
730
  declare function allFromDict<R extends ResultRecord>(results: R): Result$1<{ [K in keyof R]: OkOf<R[K]> }, ErrOf<R[keyof R]>>;
@@ -645,29 +764,30 @@ declare function allFromDictAsync<R extends AsyncResultRecord>(results: R): Asyn
645
764
  //#region src/facade.d.ts
646
765
  /**
647
766
  * Companion object grouping the standalone entry points under a single,
648
- * discoverable namespace: {@link Result.ok}, {@link Result.err},
649
- * {@link Result.defect}, {@link Result.fromNullable}, {@link Result.fromThrowable},
767
+ * discoverable namespace: {@link Result.Ok}, {@link Result.Err},
768
+ * {@link Result.Defect}, {@link Result.fromNullable}, {@link Result.fromThrowable},
650
769
  * {@link Result.fromPromise}, {@link Result.fromSafePromise}, {@link Result.all},
651
770
  * {@link Result.allAsync}, {@link Result.allFromDict},
652
771
  * {@link Result.allFromDictAsync}, {@link Result.isOk}, {@link Result.isErr},
653
- * {@link Result.isDefect}.
772
+ * {@link Result.isDefect}, {@link Result.isResult}.
654
773
  *
655
774
  * @remarks
656
775
  * Purely additive sugar — each member **is** the corresponding free function.
657
776
  * The free functions remain the primary, tree-shakeable API; importing only
658
- * `{ ok }` never pulls this object in. The value `Result` and the type
777
+ * `{ Ok }` never pulls this object in. The value `Result` and the type
659
778
  * {@link Result} share one name (the companion-object pattern).
660
779
  *
661
780
  * @example
662
781
  * ```ts
663
782
  * import { Result } from "unthrown";
664
- * Result.ok(1).flatMap((n) => Result.ok(n + 1)).unwrap(); // 2
783
+ * Result.Ok(1).flatMap((n) => Result.Ok(n + 1)).unwrap(); // 2
665
784
  * ```
666
785
  */
667
786
  declare const Result: {
668
- readonly ok: typeof ok;
669
- readonly err: typeof err;
670
- readonly defect: typeof defect;
787
+ readonly Ok: typeof Ok;
788
+ readonly Err: typeof Err;
789
+ readonly Defect: typeof Defect;
790
+ readonly Do: typeof Do;
671
791
  readonly fromNullable: typeof fromNullable;
672
792
  readonly fromThrowable: typeof fromThrowable;
673
793
  readonly fromPromise: typeof fromPromise;
@@ -679,6 +799,7 @@ declare const Result: {
679
799
  readonly isOk: typeof isOk;
680
800
  readonly isErr: typeof isErr;
681
801
  readonly isDefect: typeof isDefect;
802
+ readonly isResult: typeof isResult;
682
803
  };
683
804
  type Result<T, E> = Result$1<T, E>;
684
805
  //#endregion
@@ -804,5 +925,5 @@ declare function matchTags<T, E extends {
804
925
  _tag: string;
805
926
  }, R>(result: AsyncResult<T, E>, handlers: TagHandlers<T, E, R>): Promise<R>;
806
927
  //#endregion
807
- export { type AsyncErrOf, type AsyncOkOf, type AsyncResult, type Awaitable, type Defect, type DefectView, type ErrOf, type ErrView, type OkOf, type OkView, Result, type TagHandlers, TaggedError, type TaggedErrorConstructor, type TaggedErrorInstance, UnwrapError, all, allAsync, allFromDict, allFromDictAsync, defect, err, fromNullable, fromPromise, fromSafePromise, fromThrowable, isDefect, isErr, isOk, matchTags, ok };
928
+ export { type AsyncErrOf, type AsyncOkOf, type AsyncResult, type Awaitable, Defect, type DefectView, Do, Err, type ErrOf, type ErrView, Ok, type OkOf, type OkView, Result, type TagHandlers, TaggedError, type TaggedErrorConstructor, type TaggedErrorInstance, UnwrapError, all, allAsync, allFromDict, allFromDictAsync, fromNullable, fromPromise, fromSafePromise, fromThrowable, isDefect, isErr, isOk, isResult, matchTags };
808
929
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/constructors.ts","../src/core.ts","../src/defect.ts","../src/interop.ts","../src/facade.ts","../src/tagged.ts"],"mappings":";;AAWA;;;;;;;;KAAY,aAAA;EAqB6B;;;;;;;;;EAXvC,GAAA,IAAO,CAAA,GAAI,KAAA,EAAO,CAAA,KAAM,CAAA,GAAI,QAAA,CAAO,CAAA,EAAG,CAAA;EAoBV;;;;;;;;;;EAT5B,OAAA,QAAe,CAAA,GAAI,KAAA,EAAO,CAAA,KAAM,QAAA,CAAO,CAAA,EAAG,EAAA,IAAM,QAAA,CAAO,CAAA,EAAG,CAAA,GAAI,EAAA;EAkC7C;;;;;;;;EAzBjB,GAAA,CAAI,CAAA,GAAI,KAAA,EAAO,CAAA,YAAa,QAAA,CAAO,CAAA,EAAG,CAAA;EA+CP;;;;;;;;;;;;;;;;EA9B/B,OAAA,KAAY,CAAA,GAAI,KAAA,EAAO,CAAA,KAAM,QAAA,UAAgB,EAAA,IAAM,QAAA,CAAO,CAAA,EAAG,CAAA,GAAI,EAAA;EAmEE;;;;;;;EA3DnE,EAAA,IAAM,KAAA,EAAO,CAAA,GAAI,QAAA,CAAO,CAAA,EAAG,CAAA;EAiFG;;;;;;;;;EAtE9B,MAAA,KAAW,CAAA,GAAI,KAAA,EAAO,CAAA,KAAM,EAAA,GAAK,QAAA,CAAO,CAAA,EAAG,EAAA;EAsGnB;;;;;;;;;;EA3FxB,MAAA,QAAc,CAAA,GAAI,KAAA,EAAO,CAAA,KAAM,QAAA,CAAO,CAAA,EAAG,EAAA,IAAM,QAAA,CAAO,CAAA,GAAI,CAAA,EAAG,EAAA;EA8G9B;;;;;;;;;;;;;EAhG/B,OAAA,IAAW,CAAA,GAAI,KAAA,EAAO,CAAA,KAAM,CAAA,GAAI,QAAA,CAAO,CAAA,GAAI,CAAA;EAjFn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CAAA,IAC3B,CAAA;AAAA,iBACa,SAAA;EAAyB,IAAA;AAAA,MACvC,MAAA,EAAQ,WAAA,CAAY,CAAA,EAAG,CAAA,GACvB,QAAA,EAAU,WAAA,CAAY,CAAA,EAAG,CAAA,EAAG,CAAA,IAC3B,OAAA,CAAQ,CAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/constructors.ts","../src/core.ts","../src/defect.ts","../src/do.ts","../src/interop.ts","../src/facade.ts","../src/tagged.ts"],"mappings":";;AAQA;;;;;KAAY,QAAA,oBAA4B,CAAA,GAAI,CAAA,CAAE,CAAA;;;;;;;AAAC;AAU/C;KAAY,KAAA,2BAAgC,QAAA,CAAS,IAAA,CAAK,CAAA,EAAG,CAAA,qBAAsB,CAAA,GAAI,CAAA;;;;;;;;;;KAW3E,aAAA;EAXgC;;;;;;;;AAA4C;EAqBtF,GAAA,IAAO,CAAA,GAAI,KAAA,EAAO,CAAA,KAAM,CAAA,GAAI,QAAA,CAAO,CAAA,EAAG,CAAA;EAVf;;;;;;;;;;EAqBvB,OAAA,QAAe,CAAA,GAAI,KAAA,EAAO,CAAA,KAAM,QAAA,CAAO,CAAA,EAAG,EAAA,IAAM,QAAA,CAAO,CAAA,EAAG,CAAA,GAAI,EAAA;EAAP;;;;;;;;EASvD,GAAA,CAAI,CAAA,GAAI,KAAA,EAAO,CAAA,YAAa,QAAA,CAAO,CAAA,EAAG,CAAA;EAiBO;;;;;;;;;;;;;;;;EAA7C,OAAA,KAAY,CAAA,GAAI,KAAA,EAAO,CAAA,KAAM,QAAA,UAAgB,EAAA,IAAM,QAAA,CAAO,CAAA,EAAG,CAAA,GAAI,EAAA;EAuB9D;;;;;;;;;;;;;;;;;;;EAHH,IAAA,0BACE,IAAA,EAAM,CAAA,EACN,CAAA,GAAI,KAAA,EAAO,CAAA,KAAM,QAAA,CAAO,CAAA,EAAG,EAAA,IAC1B,QAAA,CAAO,KAAA,CAAM,CAAA,EAAG,CAAA,EAAG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