functype 0.20.2 → 0.40.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.
@@ -1,5 +1,5 @@
1
- import { t as Brand } from "./Brand-B-0nKo7I.js";
2
- import { c as Pipe, l as Foldable, o as Serializable, r as Typeable, t as Tuple, u as Type } from "./Tuple-CKxIyX7l.js";
1
+ import { t as Brand } from "./Brand-BPeggBaO.js";
2
+ import { c as Pipe, l as Foldable, o as Serializable, r as Typeable, t as Tuple, u as Type } from "./Tuple-C4maYbiO.js";
3
3
 
4
4
  //#region src/do/protocol.d.ts
5
5
 
@@ -11,9 +11,9 @@ import { c as Pipe, l as Foldable, o as Serializable, r as Typeable, t as Tuple,
11
11
  * Result type for Do-notation unwrapping
12
12
  * Indicates whether unwrapping succeeded and provides the value or error
13
13
  */
14
- type DoResult<T$1> = {
14
+ type DoResult<T> = {
15
15
  ok: true;
16
- value: T$1;
16
+ value: T;
17
17
  } | {
18
18
  ok: false;
19
19
  empty: true;
@@ -29,8 +29,8 @@ type DoResult<T$1> = {
29
29
  * The doUnwrap method should return a DoResult indicating success/failure
30
30
  * and the contained value or error information
31
31
  */
32
- interface Doable<T$1> {
33
- doUnwrap(): DoResult<T$1>;
32
+ interface Doable<T> {
33
+ doUnwrap(): DoResult<T>;
34
34
  }
35
35
  //#endregion
36
36
  //#region src/extractable/Extractable.d.ts
@@ -41,14 +41,14 @@ interface Doable<T$1> {
41
41
  * @interface Unsafe
42
42
  * @template T The type of value that can be extracted
43
43
  */
44
- interface Unsafe<T$1 extends Type> {
44
+ interface Unsafe<T extends Type> {
45
45
  /**
46
46
  * Extract the value or throw an error
47
47
  * @param error Optional custom error to throw. If not provided, uses type-appropriate default error
48
48
  * @throws {Error} The specified error, container's error, or a sensible default
49
49
  * @returns The contained value
50
50
  */
51
- orThrow(error?: Error): T$1;
51
+ orThrow(error?: Error): T;
52
52
  }
53
53
  /**
54
54
  * Extractable type class for data structures that can extract their values
@@ -59,34 +59,34 @@ interface Unsafe<T$1 extends Type> {
59
59
  *
60
60
  * Extends Unsafe to provide exception-throwing operations alongside safe alternatives.
61
61
  */
62
- interface Extractable<T$1 extends Type> extends Unsafe<T$1> {
62
+ interface Extractable<T extends Type> extends Unsafe<T> {
63
63
  /**
64
64
  * Returns the contained value or a default value
65
65
  * @param defaultValue - The value to return if extraction fails
66
66
  * @returns The contained value or defaultValue
67
67
  */
68
- orElse(defaultValue: T$1): T$1;
68
+ orElse(defaultValue: T): T;
69
69
  /**
70
70
  * Returns this container if it has a value, otherwise returns the alternative container
71
71
  * @param alternative - The alternative container
72
72
  * @returns This container or the alternative
73
73
  */
74
- or(alternative: Extractable<T$1>): Extractable<T$1>;
74
+ or(alternative: Extractable<T>): Extractable<T>;
75
75
  /**
76
76
  * Returns the contained value or null
77
77
  * @returns The contained value or null
78
78
  */
79
- orNull(): T$1 | null;
79
+ orNull(): T | null;
80
80
  /**
81
81
  * Returns the contained value or undefined
82
82
  * @returns The contained value or undefined
83
83
  */
84
- orUndefined(): T$1 | undefined;
84
+ orUndefined(): T | undefined;
85
85
  }
86
86
  /**
87
87
  * Type guard to check if a value implements Extractable
88
88
  */
89
- declare function isExtractable<T$1 extends Type>(value: unknown): value is Extractable<T$1>;
89
+ declare function isExtractable<T extends Type>(value: unknown): value is Extractable<T>;
90
90
  //#endregion
91
91
  //#region src/list/LazyList.d.ts
92
92
  /**
@@ -372,37 +372,37 @@ interface Promisable<A extends Type> {
372
372
  * Possible types of Try instances
373
373
  */
374
374
  type TypeNames = "Success" | "Failure";
375
- interface Try<T$1> extends FunctypeBase<T$1, TypeNames>, Extractable<T$1>, Pipe<T$1>, Promisable<T$1>, Doable<T$1>, Reshapeable<T$1> {
375
+ interface Try<T> extends FunctypeBase<T, TypeNames>, Extractable<T>, Pipe<T>, Promisable<T>, Doable<T>, Reshapeable<T> {
376
376
  readonly _tag: TypeNames;
377
377
  readonly error: Error | undefined;
378
- isSuccess(): this is Try<T$1> & {
378
+ isSuccess(): this is Try<T> & {
379
379
  readonly _tag: "Success";
380
380
  error: undefined;
381
381
  };
382
- isFailure(): this is Try<T$1> & {
382
+ isFailure(): this is Try<T> & {
383
383
  readonly _tag: "Failure";
384
384
  error: Error;
385
385
  };
386
- orElse: (defaultValue: T$1) => T$1;
387
- orThrow: (error?: Error) => T$1;
388
- or: (alternative: Try<T$1>) => Try<T$1>;
389
- orNull: () => T$1 | null;
390
- orUndefined: () => T$1 | undefined;
391
- toOption: () => Option<T$1>;
392
- toEither: <E extends Type>(leftValue: E) => Either<E, T$1>;
393
- toList: () => List<T$1>;
394
- toTry: () => Try<T$1>;
395
- map: <U>(f: (value: T$1) => U) => Try<U>;
396
- ap: <U>(ff: Try<(value: T$1) => U>) => Try<U>;
397
- flatMap: <U>(f: (value: T$1) => Try<U>) => Try<U>;
398
- flatMapAsync: <U>(f: (value: T$1) => Promise<Try<U>>) => Promise<Try<U>>;
386
+ orElse: (defaultValue: T) => T;
387
+ orThrow: (error?: Error) => T;
388
+ or: (alternative: Try<T>) => Try<T>;
389
+ orNull: () => T | null;
390
+ orUndefined: () => T | undefined;
391
+ toOption: () => Option<T>;
392
+ toEither: <E extends Type>(leftValue: E) => Either<E, T>;
393
+ toList: () => List<T>;
394
+ toTry: () => Try<T>;
395
+ map: <U>(f: (value: T) => U) => Try<U>;
396
+ ap: <U>(ff: Try<(value: T) => U>) => Try<U>;
397
+ flatMap: <U>(f: (value: T) => Try<U>) => Try<U>;
398
+ flatMapAsync: <U>(f: (value: T) => Promise<Try<U>>) => Promise<Try<U>>;
399
399
  /**
400
400
  * Pattern matches over the Try, applying onFailure if Failure and onSuccess if Success
401
401
  * @param onFailure - Function to apply if the Try is Failure
402
402
  * @param onSuccess - Function to apply if the Try is Success
403
403
  * @returns The result of applying the appropriate function
404
404
  */
405
- fold: <U extends Type>(onFailure: (error: Error) => U, onSuccess: (value: T$1) => U) => U;
405
+ fold: <U extends Type>(onFailure: (error: Error) => U, onSuccess: (value: T) => U) => U;
406
406
  toString: () => string;
407
407
  /**
408
408
  * Pattern matches over the Try, applying a handler function based on the variant
@@ -410,21 +410,21 @@ interface Try<T$1> extends FunctypeBase<T$1, TypeNames>, Extractable<T$1>, Pipe<
410
410
  * @returns The result of applying the matching handler function
411
411
  */
412
412
  match<R$1>(patterns: {
413
- Success: (value: T$1) => R$1;
413
+ Success: (value: T) => R$1;
414
414
  Failure: (error: Error) => R$1;
415
415
  }): R$1;
416
416
  toValue(): {
417
417
  _tag: TypeNames;
418
- value: T$1 | Error;
418
+ value: T | Error;
419
419
  };
420
420
  }
421
- declare const Try: (<T$1>(f: () => T$1) => Try<T$1>) & {
421
+ declare const Try: (<T>(f: () => T) => Try<T>) & {
422
422
  /**
423
423
  * Type guard to check if a Try is Success
424
424
  * @param tryValue - The Try to check
425
425
  * @returns True if Try is Success
426
426
  */
427
- isSuccess: <T$1>(tryValue: Try<T$1>) => tryValue is Try<T$1> & {
427
+ isSuccess: <T>(tryValue: Try<T>) => tryValue is Try<T> & {
428
428
  readonly _tag: "Success";
429
429
  error: undefined;
430
430
  };
@@ -433,7 +433,7 @@ declare const Try: (<T$1>(f: () => T$1) => Try<T$1>) & {
433
433
  * @param tryValue - The Try to check
434
434
  * @returns True if Try is Failure
435
435
  */
436
- isFailure: <T$1>(tryValue: Try<T$1>) => tryValue is Try<T$1> & {
436
+ isFailure: <T>(tryValue: Try<T>) => tryValue is Try<T> & {
437
437
  readonly _tag: "Failure";
438
438
  error: Error;
439
439
  };
@@ -442,19 +442,19 @@ declare const Try: (<T$1>(f: () => T$1) => Try<T$1>) & {
442
442
  * @param json - The JSON string
443
443
  * @returns Try instance
444
444
  */
445
- fromJSON: <T$1>(json: string) => Try<T$1>;
445
+ fromJSON: <T>(json: string) => Try<T>;
446
446
  /**
447
447
  * Creates a Try from YAML string
448
448
  * @param yaml - The YAML string
449
449
  * @returns Try instance
450
450
  */
451
- fromYAML: <T$1>(yaml: string) => Try<T$1>;
451
+ fromYAML: <T>(yaml: string) => Try<T>;
452
452
  /**
453
453
  * Creates a Try from binary string
454
454
  * @param binary - The binary string
455
455
  * @returns Try instance
456
456
  */
457
- fromBinary: <T$1>(binary: string) => Try<T$1>;
457
+ fromBinary: <T>(binary: string) => Try<T>;
458
458
  };
459
459
  //#endregion
460
460
  //#region src/reshapeable/Reshapeable.d.ts
@@ -491,7 +491,7 @@ declare const Try: (<T$1>(f: () => T$1) => Try<T$1>) & {
491
491
  * const asOption = result.toOption()
492
492
  * asOption.map(x => x * 2).orElse(0)
493
493
  */
494
- interface Reshapeable<T$1 extends Type> {
494
+ interface Reshapeable<T extends Type> {
495
495
  /**
496
496
  * Converts this monad to an Option.
497
497
  *
@@ -503,7 +503,7 @@ interface Reshapeable<T$1 extends Type> {
503
503
  *
504
504
  * @returns An Option containing the value if present, None otherwise
505
505
  */
506
- toOption(): Option<T$1>;
506
+ toOption(): Option<T>;
507
507
  /**
508
508
  * Converts this monad to an Either.
509
509
  *
@@ -516,7 +516,7 @@ interface Reshapeable<T$1 extends Type> {
516
516
  * @param leftValue - The value to use for the Left case when the source is empty/none/failure
517
517
  * @returns An Either with the value as Right or the provided leftValue as Left
518
518
  */
519
- toEither<E extends Type>(leftValue: E): Either<E, T$1>;
519
+ toEither<E extends Type>(leftValue: E): Either<E, T>;
520
520
  /**
521
521
  * Converts this monad to a List.
522
522
  *
@@ -528,7 +528,7 @@ interface Reshapeable<T$1 extends Type> {
528
528
  *
529
529
  * @returns A List containing the value(s) if present, empty List otherwise
530
530
  */
531
- toList(): List<T$1>;
531
+ toList(): List<T>;
532
532
  /**
533
533
  * Converts this monad to a Try.
534
534
  *
@@ -540,22 +540,22 @@ interface Reshapeable<T$1 extends Type> {
540
540
  *
541
541
  * @returns A Try containing Success with the value or Failure with an appropriate error
542
542
  */
543
- toTry(): Try<T$1>;
543
+ toTry(): Try<T>;
544
544
  }
545
545
  //#endregion
546
546
  //#region src/branded/ValidatedBrand.d.ts
547
- type ValidatedBrand<K$1 extends string, T$1> = Brand<K$1, T$1> & {
547
+ type ValidatedBrand<K$1 extends string, T> = Brand<K$1, T> & {
548
548
  readonly __validated: true;
549
549
  };
550
- interface ValidatedBrandCompanion<K$1 extends string, T$1> {
550
+ interface ValidatedBrandCompanion<K$1 extends string, T> {
551
551
  readonly brand: K$1;
552
- readonly validate: (value: T$1) => boolean;
553
- readonly of: (value: T$1) => Option<ValidatedBrand<K$1, T$1>>;
554
- readonly from: (value: T$1) => Either<string, ValidatedBrand<K$1, T$1>>;
555
- readonly unsafeOf: (value: T$1) => ValidatedBrand<K$1, T$1>;
556
- readonly is: (value: unknown) => value is ValidatedBrand<K$1, T$1>;
557
- readonly unwrap: (branded: Brand<K$1, T$1>) => T$1;
558
- readonly refine: <K2 extends string>(brand: K2, validate: (value: Brand<K$1, T$1>) => boolean) => ValidatedBrandCompanion<K2, Brand<K$1, T$1>>;
552
+ readonly validate: (value: T) => boolean;
553
+ readonly of: (value: T) => Option<ValidatedBrand<K$1, T>>;
554
+ readonly from: (value: T) => Either<string, ValidatedBrand<K$1, T>>;
555
+ readonly unsafeOf: (value: T) => ValidatedBrand<K$1, T>;
556
+ readonly is: (value: unknown) => value is ValidatedBrand<K$1, T>;
557
+ readonly unwrap: (branded: Brand<K$1, T>) => T;
558
+ readonly refine: <K2 extends string>(brand: K2, validate: (value: Brand<K$1, T>) => boolean) => ValidatedBrandCompanion<K2, Brand<K$1, T>>;
559
559
  }
560
560
  /**
561
561
  * Create a validated brand with runtime validation
@@ -590,7 +590,7 @@ interface ValidatedBrandCompanion<K$1 extends string, T$1> {
590
590
  * // ❌ ValidatedBrand("ValidatedUserId", ...) + Brand<"UserId", string>
591
591
  * // ✅ ValidatedBrand("UserId", ...) + Brand<"UserId", string>
592
592
  */
593
- declare function ValidatedBrand<K$1 extends string, T$1>(brand: K$1, validate: (value: T$1) => boolean): ValidatedBrandCompanion<K$1, T$1>;
593
+ declare function ValidatedBrand<K$1 extends string, T>(brand: K$1, validate: (value: T) => boolean): ValidatedBrandCompanion<K$1, T>;
594
594
  /**
595
595
  * Positive number brand (> 0)
596
596
  * @example
@@ -703,7 +703,7 @@ declare function Companion<ObjectF extends object, CompanionF extends object>(ob
703
703
  * // { from: ..., none: ..., fromJSON: ..., etc. }
704
704
  * ```
705
705
  */
706
- type CompanionMethods<T$1> = T$1 extends ((...args: never[]) => unknown) & infer C ? C : never;
706
+ type CompanionMethods<T> = T extends ((...args: never[]) => unknown) & infer C ? C : never;
707
707
  /**
708
708
  * Extracts the instance type from a constructor function
709
709
  * @typeParam T - The constructor function type
@@ -713,7 +713,7 @@ type CompanionMethods<T$1> = T$1 extends ((...args: never[]) => unknown) & infer
713
713
  * // Option<T>
714
714
  * ```
715
715
  */
716
- type InstanceType<T$1> = T$1 extends ((...args: infer Args) => infer R) ? R extends ((...args: unknown[]) => unknown) ? ReturnType<R> : R : never;
716
+ type InstanceType<T> = T extends ((...args: infer Args) => infer R) ? R extends ((...args: unknown[]) => unknown) ? ReturnType<R> : R : never;
717
717
  /**
718
718
  * Type guard to check if a value is a Companion object (has both constructor and companion methods)
719
719
  * @param value - The value to check
@@ -740,29 +740,29 @@ declare const isCompanion: (value: unknown) => value is ((...args: never[]) => u
740
740
  * .elseWhen(response.status >= 200, "Success")
741
741
  * .else("Unknown")
742
742
  */
743
- type Cond<T$1 extends Type> = {
743
+ type Cond<T extends Type> = {
744
744
  /**
745
745
  * Add an if condition
746
746
  */
747
- when: (condition: boolean, value: T$1 | (() => T$1)) => Cond<T$1>;
747
+ when: (condition: boolean, value: T | (() => T)) => Cond<T>;
748
748
  /**
749
749
  * Add an else-if condition
750
750
  */
751
- elseWhen: (condition: boolean, value: T$1 | (() => T$1)) => Cond<T$1>;
751
+ elseWhen: (condition: boolean, value: T | (() => T)) => Cond<T>;
752
752
  /**
753
753
  * Terminal else clause - required to get the result
754
754
  */
755
- else: (value: T$1 | (() => T$1)) => T$1;
755
+ else: (value: T | (() => T)) => T;
756
756
  /**
757
757
  * Get the result if a condition was met, throws if no condition met
758
758
  */
759
- orThrow: () => T$1;
759
+ orThrow: () => T;
760
760
  };
761
761
  /** @internal */
762
- type LazyCondChain<T$1> = {
763
- when: (condition: () => boolean, value: () => T$1) => LazyCondChain<T$1>;
764
- elseWhen: (condition: () => boolean, value: () => T$1) => LazyCondChain<T$1>;
765
- else: (value: () => T$1) => T$1;
762
+ type LazyCondChain<T> = {
763
+ when: (condition: () => boolean, value: () => T) => LazyCondChain<T>;
764
+ elseWhen: (condition: () => boolean, value: () => T) => LazyCondChain<T>;
765
+ else: (value: () => T) => T;
766
766
  };
767
767
  /**
768
768
  * Conditional expression builder for functional if/else chains
@@ -788,7 +788,7 @@ type LazyCondChain<T$1> = {
788
788
  * .when(() => checkCondition2(), () => "Result 2")
789
789
  * .else(() => "Default")
790
790
  */
791
- declare const Cond: (<T$1 extends Type>() => Cond<T$1>) & {
791
+ declare const Cond: (<T extends Type>() => Cond<T>) & {
792
792
  /**
793
793
  * Create a conditional expression that must end with else
794
794
  * @example
@@ -806,7 +806,7 @@ declare const Cond: (<T$1 extends Type>() => Cond<T$1>) & {
806
806
  * .when(isLoyal, () => calculateLoyaltyDiscount())
807
807
  * .else(0)
808
808
  */
809
- of: <T$1 extends Type>() => Cond<T$1>;
809
+ of: <T extends Type>() => Cond<T>;
810
810
  /**
811
811
  * Pattern matching helper that ensures exhaustiveness
812
812
  * @example
@@ -828,7 +828,7 @@ declare const Cond: (<T$1 extends Type>() => Cond<T$1>) & {
828
828
  * "skip": () => defaultValue
829
829
  * })
830
830
  */
831
- match: <T$1 extends string | number | symbol>(value: T$1) => <R$1 extends Type>(cases: Record<T$1, R$1 | (() => R$1)>) => R$1;
831
+ match: <T extends string | number | symbol>(value: T) => <R$1 extends Type>(cases: Record<T, R$1 | (() => R$1)>) => R$1;
832
832
  /**
833
833
  * Create a lazy conditional that defers evaluation
834
834
  * @example
@@ -851,7 +851,7 @@ declare const Cond: (<T$1 extends Type>() => Cond<T$1>) & {
851
851
  * )
852
852
  * .else(() => ({ type: "guest", permissions: [] }))
853
853
  */
854
- lazy: <T$1 extends Type>() => LazyCondChain<T$1>;
854
+ lazy: <T extends Type>() => LazyCondChain<T>;
855
855
  };
856
856
  //#endregion
857
857
  //#region src/conditional/Match.d.ts
@@ -861,21 +861,21 @@ declare const Cond: (<T$1 extends Type>() => Cond<T$1>) & {
861
861
  */
862
862
  type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
863
863
  /** @internal */
864
- type IsUnion<T$1> = [T$1] extends [UnionToIntersection<T$1>] ? false : true;
864
+ type IsUnion<T> = [T] extends [UnionToIntersection<T>] ? false : true;
865
865
  /** @internal */
866
- type RequireExhaustive<T$1, Cases> = IsUnion<T$1> extends true ? (keyof Cases extends T$1 ? (T$1 extends keyof Cases ? Cases : never) : never) : Cases;
866
+ type RequireExhaustive<T, Cases> = IsUnion<T> extends true ? (keyof Cases extends T ? (T extends keyof Cases ? Cases : never) : never) : Cases;
867
867
  /**
868
868
  * Pattern types for nested matching
869
869
  * @internal
870
870
  */
871
- type Pattern<T$1> = T$1 | { [K in keyof T$1]?: Pattern<T$1[K]> } | ((value: T$1) => boolean) | {
872
- _: (value: T$1) => boolean;
871
+ type Pattern<T> = T | { [K in keyof T]?: Pattern<T[K]> } | ((value: T) => boolean) | {
872
+ _: (value: T) => boolean;
873
873
  };
874
874
  /**
875
875
  * Extract result from pattern
876
876
  * @internal
877
877
  */
878
- type PatternResult<T$1, R$1> = R$1 | ((matched: T$1) => R$1);
878
+ type PatternResult<T, R$1> = R$1 | ((matched: T) => R$1);
879
879
  /**
880
880
  * Pattern matching construct similar to Scala's match expressions.
881
881
  * Supports exhaustive matching, nested patterns, and guards.
@@ -903,31 +903,31 @@ type PatternResult<T$1, R$1> = R$1 | ((matched: T$1) => R$1);
903
903
  * .case({ role: "user" }, u => `User: ${u.name}`)
904
904
  * .default("Guest")
905
905
  */
906
- type Match<T$1 extends Type, R$1 extends Type> = {
906
+ type Match<T extends Type, R$1 extends Type> = {
907
907
  /**
908
908
  * Match against a pattern (value, nested object, or predicate)
909
909
  */
910
- case: (pattern: Pattern<T$1>, result: PatternResult<T$1, R$1>) => Match<T$1, R$1>;
910
+ case: (pattern: Pattern<T>, result: PatternResult<T, R$1>) => Match<T, R$1>;
911
911
  /**
912
912
  * Add a case that matches a specific value (backward compatibility)
913
913
  */
914
- caseValue: (match: T$1, result: R$1 | (() => R$1)) => Match<T$1, R$1>;
914
+ caseValue: (match: T, result: R$1 | (() => R$1)) => Match<T, R$1>;
915
915
  /**
916
916
  * Add a case that matches multiple values (backward compatibility)
917
917
  */
918
- caseValues: (matches: T$1[], result: R$1 | (() => R$1)) => Match<T$1, R$1>;
918
+ caseValues: (matches: T[], result: R$1 | (() => R$1)) => Match<T, R$1>;
919
919
  /**
920
920
  * Match with a guard function (alias for readability)
921
921
  */
922
- when: (guard: (value: T$1) => boolean, result: PatternResult<T$1, R$1>) => Match<T$1, R$1>;
922
+ when: (guard: (value: T) => boolean, result: PatternResult<T, R$1>) => Match<T, R$1>;
923
923
  /**
924
924
  * Match multiple patterns (OR operation)
925
925
  */
926
- caseAny: (patterns: Pattern<T$1>[], result: PatternResult<T$1, R$1>) => Match<T$1, R$1>;
926
+ caseAny: (patterns: Pattern<T>[], result: PatternResult<T, R$1>) => Match<T, R$1>;
927
927
  /**
928
928
  * Default case - makes match non-exhaustive
929
929
  */
930
- default: (result: PatternResult<T$1, R$1>) => R$1;
930
+ default: (result: PatternResult<T, R$1>) => R$1;
931
931
  /**
932
932
  * Force exhaustive matching (compile-time check for union types)
933
933
  */
@@ -981,7 +981,7 @@ type Match<T$1 extends Type, R$1 extends Type> = {
981
981
  * .case("error", "Failed!")
982
982
  * .exhaustive()
983
983
  */
984
- declare const Match: (<T$1 extends Type, R$1 extends Type>(value: T$1) => Match<T$1, R$1>) & {
984
+ declare const Match: (<T extends Type, R$1 extends Type>(value: T) => Match<T, R$1>) & {
985
985
  /**
986
986
  * Create a type-safe exhaustive match for union types
987
987
  * @example
@@ -1005,7 +1005,7 @@ declare const Match: (<T$1 extends Type, R$1 extends Type>(value: T$1) => Match<
1005
1005
  * const compute = ops("multiply").fn
1006
1006
  * const result = compute(4, 5) // 20
1007
1007
  */
1008
- exhaustive: <T$1 extends string | number | symbol, R$1 extends Type>(cases: RequireExhaustive<T$1, Record<T$1, R$1>>) => (value: T$1) => R$1;
1008
+ exhaustive: <T extends string | number | symbol, R$1 extends Type>(cases: RequireExhaustive<T, Record<T, R$1>>) => (value: T) => R$1;
1009
1009
  /**
1010
1010
  * Create a partial match that requires a default
1011
1011
  * @example
@@ -1027,8 +1027,8 @@ declare const Match: (<T$1 extends Type, R$1 extends Type>(value: T$1) => Match<
1027
1027
  * }).withDefault((n) => `Number: ${n}`)
1028
1028
  * getMessage(5) // "Number: 5"
1029
1029
  */
1030
- partial: <T$1 extends string | number | symbol, R$1 extends Type>(cases: Partial<Record<T$1, R$1 | ((value: T$1) => R$1)>>) => {
1031
- withDefault: (defaultValue: R$1 | ((value: T$1) => R$1)) => (value: T$1) => R$1;
1030
+ partial: <T extends string | number | symbol, R$1 extends Type>(cases: Partial<Record<T, R$1 | ((value: T) => R$1)>>) => {
1031
+ withDefault: (defaultValue: R$1 | ((value: T) => R$1)) => (value: T) => R$1;
1032
1032
  };
1033
1033
  /**
1034
1034
  * Pattern match with guards
@@ -1053,8 +1053,8 @@ declare const Match: (<T$1 extends Type, R$1 extends Type>(value: T$1) => Match<
1053
1053
  * ]).withDefault("Unknown")(age)
1054
1054
  * // category = "Adult (25 years)"
1055
1055
  */
1056
- withGuards: <T$1 extends Type, R$1 extends Type>(guards: Array<[(value: T$1) => boolean, R$1 | ((value: T$1) => R$1)]>) => {
1057
- withDefault: (defaultValue: R$1 | ((value: T$1) => R$1)) => (value: T$1) => R$1;
1056
+ withGuards: <T extends Type, R$1 extends Type>(guards: Array<[(value: T) => boolean, R$1 | ((value: T) => R$1)]>) => {
1057
+ withDefault: (defaultValue: R$1 | ((value: T) => R$1)) => (value: T) => R$1;
1058
1058
  };
1059
1059
  /**
1060
1060
  * Pattern matching for objects with specific structure
@@ -1070,9 +1070,9 @@ declare const Match: (<T$1 extends Type, R$1 extends Type>(value: T$1) => Match<
1070
1070
  * .case({ type: "hover" }, (e) => console.log(`Hovering over ${e.element}`))
1071
1071
  * .build()
1072
1072
  */
1073
- struct: <T$1 extends Type, R$1 extends Type>() => {
1074
- case: (pattern: Pattern<T$1>, handler: (value: T$1) => R$1) => /*elided*/any;
1075
- build: () => (value: T$1) => R$1;
1073
+ struct: <T extends Type, R$1 extends Type>() => {
1074
+ case: (pattern: Pattern<T>, handler: (value: T) => R$1) => /*elided*/any;
1075
+ build: () => (value: T) => R$1;
1076
1076
  };
1077
1077
  /**
1078
1078
  * Create a pattern matcher with guards and nested patterns
@@ -1089,11 +1089,11 @@ declare const Match: (<T$1 extends Type, R$1 extends Type>(value: T$1) => Match<
1089
1089
  * .default(false)
1090
1090
  * .build()
1091
1091
  */
1092
- builder: <T$1 extends Type, R$1 extends Type>() => {
1093
- case: (pattern: Pattern<T$1>, result: PatternResult<T$1, R$1>) => /*elided*/any;
1094
- when: (guard: (value: T$1) => boolean, result: PatternResult<T$1, R$1>) => /*elided*/any;
1095
- default: (result: PatternResult<T$1, R$1>) => {
1096
- build: () => (value: T$1) => R$1;
1092
+ builder: <T extends Type, R$1 extends Type>() => {
1093
+ case: (pattern: Pattern<T>, result: PatternResult<T, R$1>) => /*elided*/any;
1094
+ when: (guard: (value: T) => boolean, result: PatternResult<T, R$1>) => /*elided*/any;
1095
+ default: (result: PatternResult<T, R$1>) => {
1096
+ build: () => (value: T) => R$1;
1097
1097
  };
1098
1098
  };
1099
1099
  };
@@ -1105,7 +1105,7 @@ declare const Match: (<T$1 extends Type, R$1 extends Type>(value: T$1) => Match<
1105
1105
  * @param type - The type name for the object
1106
1106
  * @param body - The implementation body
1107
1107
  */
1108
- declare function Base<T$1 extends Record<string, unknown>>(type: string, body: T$1): T$1 & {
1108
+ declare function Base<T extends Record<string, unknown>>(type: string, body: T): T & {
1109
1109
  toString(): string;
1110
1110
  doUnwrap(): DoResult<unknown>;
1111
1111
  _tag: string;
@@ -1184,22 +1184,22 @@ type ErrorContext = {
1184
1184
  /**
1185
1185
  * FPromise type that defines the function signature and methods
1186
1186
  */
1187
- type FPromise<T$1 extends Type, E extends Type = unknown> = PromiseLike<T$1> & {
1187
+ type FPromise<T extends Type, E extends Type = unknown> = PromiseLike<T> & {
1188
1188
  readonly _tag: "FPromise";
1189
- tap: (f: (value: T$1) => void) => FPromise<T$1, E>;
1190
- mapError: <E2>(f: (error: E, context: ErrorContext) => E2) => FPromise<T$1, E2>;
1191
- tapError: (f: (error: E) => void) => FPromise<T$1, E>;
1192
- recover: (fallback: T$1) => FPromise<T$1, never>;
1193
- recoverWith: (f: (error: E) => T$1) => FPromise<T$1, never>;
1194
- recoverWithF: <E2>(f: (error: E) => FPromise<T$1, E2>) => FPromise<T$1, E2>;
1195
- filterError: <E2 extends E>(predicate: (error: E) => boolean, handler: (error: E) => FPromise<T$1, E2>) => FPromise<T$1, E>;
1196
- logError: (logger: (error: E, context: ErrorContext) => void) => FPromise<T$1, E>;
1197
- toPromise: () => Promise<T$1>;
1198
- toEither: () => Promise<Either<E, T$1>>;
1199
- fold: <R$1 extends Type>(onError: (error: E) => R$1, onSuccess: (value: T$1) => R$1) => FPromise<R$1, never>;
1200
- map: <U extends Type>(f: (value: T$1) => U) => FPromise<U, E>;
1201
- flatMap: <U extends Type>(f: (value: T$1) => FPromise<U, E> | PromiseLike<U>) => FPromise<U, E>;
1202
- flatMapAsync: <U extends Type>(f: (value: T$1) => PromiseLike<U>) => Promise<U>;
1189
+ tap: (f: (value: T) => void) => FPromise<T, E>;
1190
+ mapError: <E2>(f: (error: E, context: ErrorContext) => E2) => FPromise<T, E2>;
1191
+ tapError: (f: (error: E) => void) => FPromise<T, E>;
1192
+ recover: (fallback: T) => FPromise<T, never>;
1193
+ recoverWith: (f: (error: E) => T) => FPromise<T, never>;
1194
+ recoverWithF: <E2>(f: (error: E) => FPromise<T, E2>) => FPromise<T, E2>;
1195
+ filterError: <E2 extends E>(predicate: (error: E) => boolean, handler: (error: E) => FPromise<T, E2>) => FPromise<T, E>;
1196
+ logError: (logger: (error: E, context: ErrorContext) => void) => FPromise<T, E>;
1197
+ toPromise: () => Promise<T>;
1198
+ toEither: () => Promise<Either<E, T>>;
1199
+ fold: <R$1 extends Type>(onError: (error: E) => R$1, onSuccess: (value: T) => R$1) => FPromise<R$1, never>;
1200
+ map: <U extends Type>(f: (value: T) => U) => FPromise<U, E>;
1201
+ flatMap: <U extends Type>(f: (value: T) => FPromise<U, E> | PromiseLike<U>) => FPromise<U, E>;
1202
+ flatMapAsync: <U extends Type>(f: (value: T) => PromiseLike<U>) => Promise<U>;
1203
1203
  };
1204
1204
  /**
1205
1205
  * Static utility methods for FPromise using the Companion pattern.
@@ -1218,7 +1218,7 @@ declare const FPromiseCompanion: {
1218
1218
  * const promise = FPromise.resolve(42)
1219
1219
  * // promise resolves to 42
1220
1220
  */
1221
- resolve: <T$1, E = never>(value: T$1 | PromiseLike<T$1>) => FPromise<T$1, E>;
1221
+ resolve: <T, E = never>(value: T | PromiseLike<T>) => FPromise<T, E>;
1222
1222
  /**
1223
1223
  * Creates an FPromise that rejects with the provided reason.
1224
1224
  *
@@ -1231,7 +1231,7 @@ declare const FPromiseCompanion: {
1231
1231
  * const promise = FPromise.reject<number, Error>(new Error("Something went wrong"))
1232
1232
  * // promise rejects with Error("Something went wrong")
1233
1233
  */
1234
- reject: <T$1, E = unknown>(reason: E) => FPromise<T$1, E>;
1234
+ reject: <T, E = unknown>(reason: E) => FPromise<T, E>;
1235
1235
  /**
1236
1236
  * Creates an FPromise from a regular Promise.
1237
1237
  *
@@ -1244,7 +1244,7 @@ declare const FPromiseCompanion: {
1244
1244
  * const promise = FPromise.from(fetch("https://api.example.com/data"))
1245
1245
  * // promise is an FPromise that resolves or rejects based on the fetch result
1246
1246
  */
1247
- from: <T$1, E = unknown>(promise: Promise<T$1>) => FPromise<T$1, E>;
1247
+ from: <T, E = unknown>(promise: Promise<T>) => FPromise<T, E>;
1248
1248
  /**
1249
1249
  * Creates an FPromise from an Either.
1250
1250
  * If the Either is a Right, the FPromise resolves with the Right value.
@@ -1275,7 +1275,7 @@ declare const FPromiseCompanion: {
1275
1275
  * const result = await FPromise.all(promises).toPromise()
1276
1276
  * // result is [1, 2, 3]
1277
1277
  */
1278
- all: <T$1, E = unknown>(promises: Array<FPromise<T$1, E> | PromiseLike<T$1> | T$1>) => FPromise<T$1[], E>;
1278
+ all: <T, E = unknown>(promises: Array<FPromise<T, E> | PromiseLike<T> | T>) => FPromise<T[], E>;
1279
1279
  /**
1280
1280
  * Like Promise.allSettled, returns results of all promises whether they succeed or fail.
1281
1281
  * This will always resolve, never reject.
@@ -1290,7 +1290,7 @@ declare const FPromiseCompanion: {
1290
1290
  * const result = await FPromise.allSettled(promises).toPromise()
1291
1291
  * // result is [Right(1), Left(Error("Failed"))]
1292
1292
  */
1293
- allSettled: <T$1, E = unknown>(promises: Array<FPromise<T$1, E> | PromiseLike<T$1>>) => FPromise<Array<Either<E, T$1>>, never>;
1293
+ allSettled: <T, E = unknown>(promises: Array<FPromise<T, E> | PromiseLike<T>>) => FPromise<Array<Either<E, T>>, never>;
1294
1294
  /**
1295
1295
  * Like Promise.race, returns the first promise to settle (either resolve or reject).
1296
1296
  *
@@ -1305,7 +1305,7 @@ declare const FPromiseCompanion: {
1305
1305
  * const result = await FPromise.race([slow, fast]).toPromise()
1306
1306
  * // result is 2
1307
1307
  */
1308
- race: <T$1, E = unknown>(promises: Array<FPromise<T$1, E> | PromiseLike<T$1>>) => FPromise<T$1, E>;
1308
+ race: <T, E = unknown>(promises: Array<FPromise<T, E> | PromiseLike<T>>) => FPromise<T, E>;
1309
1309
  /**
1310
1310
  * Like Promise.any, returns the first promise to fulfill.
1311
1311
  * This will only reject if all promises reject.
@@ -1324,7 +1324,7 @@ declare const FPromiseCompanion: {
1324
1324
  * const result = await FPromise.any(promises).toPromise()
1325
1325
  * // result is 2
1326
1326
  */
1327
- any: <T$1, E = unknown>(promises: Array<FPromise<T$1, E> | PromiseLike<T$1>>) => FPromise<T$1, E>;
1327
+ any: <T, E = unknown>(promises: Array<FPromise<T, E> | PromiseLike<T>>) => FPromise<T, E>;
1328
1328
  /**
1329
1329
  * Retries an operation with exponential backoff.
1330
1330
  * This is useful for operations that may fail temporarily, such as network requests.
@@ -1352,11 +1352,11 @@ declare const FPromiseCompanion: {
1352
1352
  * shouldRetry: (error) => error.message === "Temporary failure"
1353
1353
  * }).toPromise()
1354
1354
  */
1355
- retryWithBackoff: <T$1, E = unknown>(operation: () => FPromise<T$1, E>, options: {
1355
+ retryWithBackoff: <T, E = unknown>(operation: () => FPromise<T, E>, options: {
1356
1356
  maxRetries: number;
1357
1357
  baseDelay?: number;
1358
1358
  shouldRetry?: (error: E, attempt: number) => boolean;
1359
- }) => FPromise<T$1, E>;
1359
+ }) => FPromise<T, E>;
1360
1360
  };
1361
1361
  /**
1362
1362
  * Creates an FPromise from an executor function.
@@ -1366,7 +1366,7 @@ declare const FPromiseCompanion: {
1366
1366
  * @param executor - A function that receives resolve and reject functions
1367
1367
  * @returns An FPromise instance
1368
1368
  */
1369
- declare const FPromise: (<T$1 extends Type, E = unknown>(executor: (resolve: (value: T$1 | PromiseLike<T$1>) => void, reject: (reason?: E) => void) => void) => FPromise<T$1, E>) & {
1369
+ declare const FPromise: (<T extends Type, E = unknown>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: E) => void) => void) => FPromise<T, E>) & {
1370
1370
  /**
1371
1371
  * Creates an FPromise that resolves to the provided value.
1372
1372
  *
@@ -1379,7 +1379,7 @@ declare const FPromise: (<T$1 extends Type, E = unknown>(executor: (resolve: (va
1379
1379
  * const promise = FPromise.resolve(42)
1380
1380
  * // promise resolves to 42
1381
1381
  */
1382
- resolve: <T$1, E = never>(value: T$1 | PromiseLike<T$1>) => FPromise<T$1, E>;
1382
+ resolve: <T, E = never>(value: T | PromiseLike<T>) => FPromise<T, E>;
1383
1383
  /**
1384
1384
  * Creates an FPromise that rejects with the provided reason.
1385
1385
  *
@@ -1392,7 +1392,7 @@ declare const FPromise: (<T$1 extends Type, E = unknown>(executor: (resolve: (va
1392
1392
  * const promise = FPromise.reject<number, Error>(new Error("Something went wrong"))
1393
1393
  * // promise rejects with Error("Something went wrong")
1394
1394
  */
1395
- reject: <T$1, E = unknown>(reason: E) => FPromise<T$1, E>;
1395
+ reject: <T, E = unknown>(reason: E) => FPromise<T, E>;
1396
1396
  /**
1397
1397
  * Creates an FPromise from a regular Promise.
1398
1398
  *
@@ -1405,7 +1405,7 @@ declare const FPromise: (<T$1 extends Type, E = unknown>(executor: (resolve: (va
1405
1405
  * const promise = FPromise.from(fetch("https://api.example.com/data"))
1406
1406
  * // promise is an FPromise that resolves or rejects based on the fetch result
1407
1407
  */
1408
- from: <T$1, E = unknown>(promise: Promise<T$1>) => FPromise<T$1, E>;
1408
+ from: <T, E = unknown>(promise: Promise<T>) => FPromise<T, E>;
1409
1409
  /**
1410
1410
  * Creates an FPromise from an Either.
1411
1411
  * If the Either is a Right, the FPromise resolves with the Right value.
@@ -1436,7 +1436,7 @@ declare const FPromise: (<T$1 extends Type, E = unknown>(executor: (resolve: (va
1436
1436
  * const result = await FPromise.all(promises).toPromise()
1437
1437
  * // result is [1, 2, 3]
1438
1438
  */
1439
- all: <T$1, E = unknown>(promises: Array<FPromise<T$1, E> | PromiseLike<T$1> | T$1>) => FPromise<T$1[], E>;
1439
+ all: <T, E = unknown>(promises: Array<FPromise<T, E> | PromiseLike<T> | T>) => FPromise<T[], E>;
1440
1440
  /**
1441
1441
  * Like Promise.allSettled, returns results of all promises whether they succeed or fail.
1442
1442
  * This will always resolve, never reject.
@@ -1451,7 +1451,7 @@ declare const FPromise: (<T$1 extends Type, E = unknown>(executor: (resolve: (va
1451
1451
  * const result = await FPromise.allSettled(promises).toPromise()
1452
1452
  * // result is [Right(1), Left(Error("Failed"))]
1453
1453
  */
1454
- allSettled: <T$1, E = unknown>(promises: Array<FPromise<T$1, E> | PromiseLike<T$1>>) => FPromise<Array<Either<E, T$1>>, never>;
1454
+ allSettled: <T, E = unknown>(promises: Array<FPromise<T, E> | PromiseLike<T>>) => FPromise<Array<Either<E, T>>, never>;
1455
1455
  /**
1456
1456
  * Like Promise.race, returns the first promise to settle (either resolve or reject).
1457
1457
  *
@@ -1466,7 +1466,7 @@ declare const FPromise: (<T$1 extends Type, E = unknown>(executor: (resolve: (va
1466
1466
  * const result = await FPromise.race([slow, fast]).toPromise()
1467
1467
  * // result is 2
1468
1468
  */
1469
- race: <T$1, E = unknown>(promises: Array<FPromise<T$1, E> | PromiseLike<T$1>>) => FPromise<T$1, E>;
1469
+ race: <T, E = unknown>(promises: Array<FPromise<T, E> | PromiseLike<T>>) => FPromise<T, E>;
1470
1470
  /**
1471
1471
  * Like Promise.any, returns the first promise to fulfill.
1472
1472
  * This will only reject if all promises reject.
@@ -1485,7 +1485,7 @@ declare const FPromise: (<T$1 extends Type, E = unknown>(executor: (resolve: (va
1485
1485
  * const result = await FPromise.any(promises).toPromise()
1486
1486
  * // result is 2
1487
1487
  */
1488
- any: <T$1, E = unknown>(promises: Array<FPromise<T$1, E> | PromiseLike<T$1>>) => FPromise<T$1, E>;
1488
+ any: <T, E = unknown>(promises: Array<FPromise<T, E> | PromiseLike<T>>) => FPromise<T, E>;
1489
1489
  /**
1490
1490
  * Retries an operation with exponential backoff.
1491
1491
  * This is useful for operations that may fail temporarily, such as network requests.
@@ -1513,11 +1513,11 @@ declare const FPromise: (<T$1 extends Type, E = unknown>(executor: (resolve: (va
1513
1513
  * shouldRetry: (error) => error.message === "Temporary failure"
1514
1514
  * }).toPromise()
1515
1515
  */
1516
- retryWithBackoff: <T$1, E = unknown>(operation: () => FPromise<T$1, E>, options: {
1516
+ retryWithBackoff: <T, E = unknown>(operation: () => FPromise<T, E>, options: {
1517
1517
  maxRetries: number;
1518
1518
  baseDelay?: number;
1519
1519
  shouldRetry?: (error: E, attempt: number) => boolean;
1520
- }) => FPromise<T$1, E>;
1520
+ }) => FPromise<T, E>;
1521
1521
  };
1522
1522
  //#endregion
1523
1523
  //#region src/core/task/Task.d.ts
@@ -1544,59 +1544,59 @@ interface TaskMetadata {
1544
1544
  readonly name: string;
1545
1545
  readonly description: string;
1546
1546
  }
1547
- interface TaskOutcome<T$1> extends FunctypeBase<T$1, "Ok" | "Err">, Extractable<T$1>, AsyncMonad<T$1>, Promisable<T$1>, Doable<T$1> {
1547
+ interface TaskOutcome<T> extends FunctypeBase<T, "Ok" | "Err">, Extractable<T>, AsyncMonad<T>, Promisable<T>, Doable<T> {
1548
1548
  readonly _tag: "Ok" | "Err";
1549
1549
  readonly _meta: TaskMetadata;
1550
- readonly value?: T$1;
1550
+ readonly value?: T;
1551
1551
  readonly error?: Throwable;
1552
- readonly map: <U>(f: (value: T$1) => U) => TaskOutcome<U>;
1553
- readonly flatMap: <U>(f: (value: T$1) => TaskOutcome<U> | Either<Throwable, U>) => TaskOutcome<U>;
1554
- readonly ap: <U>(ff: TaskOutcome<(value: T$1) => U>) => TaskOutcome<U>;
1555
- readonly mapAsync: <U>(f: (value: T$1) => Promise<U>) => Promise<TaskOutcome<U>>;
1556
- readonly flatMapAsync: <U>(f: (value: T$1) => Promise<TaskOutcome<U>>) => Promise<TaskOutcome<U>>;
1557
- readonly mapError: (f: (error: Throwable) => Throwable) => TaskOutcome<T$1>;
1558
- readonly recover: (value: T$1) => Ok<T$1>;
1559
- readonly recoverWith: (f: (error: Throwable) => T$1) => Ok<T$1>;
1560
- readonly isSuccess: () => this is Ok<T$1>;
1561
- readonly isFailure: () => this is Err<T$1>;
1562
- readonly isOk: () => this is Ok<T$1>;
1563
- readonly isErr: () => this is Err<T$1>;
1564
- readonly toEither: () => Either<Throwable, T$1>;
1565
- readonly toTry: () => Try<T$1>;
1566
- readonly toOption: () => Option<T$1>;
1567
- readonly toList: () => List<T$1>;
1568
- readonly fold: <U>(onErr: (error: Throwable) => U, onOk: (value: T$1) => U) => U;
1552
+ readonly map: <U>(f: (value: T) => U) => TaskOutcome<U>;
1553
+ readonly flatMap: <U>(f: (value: T) => TaskOutcome<U> | Either<Throwable, U>) => TaskOutcome<U>;
1554
+ readonly ap: <U>(ff: TaskOutcome<(value: T) => U>) => TaskOutcome<U>;
1555
+ readonly mapAsync: <U>(f: (value: T) => Promise<U>) => Promise<TaskOutcome<U>>;
1556
+ readonly flatMapAsync: <U>(f: (value: T) => Promise<TaskOutcome<U>>) => Promise<TaskOutcome<U>>;
1557
+ readonly mapError: (f: (error: Throwable) => Throwable) => TaskOutcome<T>;
1558
+ readonly recover: (value: T) => Ok<T>;
1559
+ readonly recoverWith: (f: (error: Throwable) => T) => Ok<T>;
1560
+ readonly isSuccess: () => this is Ok<T>;
1561
+ readonly isFailure: () => this is Err<T>;
1562
+ readonly isOk: () => this is Ok<T>;
1563
+ readonly isErr: () => this is Err<T>;
1564
+ readonly toEither: () => Either<Throwable, T>;
1565
+ readonly toTry: () => Try<T>;
1566
+ readonly toOption: () => Option<T>;
1567
+ readonly toList: () => List<T>;
1568
+ readonly fold: <U>(onErr: (error: Throwable) => U, onOk: (value: T) => U) => U;
1569
1569
  readonly match: <U>(patterns: {
1570
- Ok: (value: T$1) => U;
1570
+ Ok: (value: T) => U;
1571
1571
  Err: (error: Throwable) => U;
1572
1572
  }) => U;
1573
1573
  }
1574
- interface Ok<T$1> extends TaskOutcome<T$1> {
1574
+ interface Ok<T> extends TaskOutcome<T> {
1575
1575
  readonly _tag: "Ok";
1576
- readonly value: T$1;
1576
+ readonly value: T;
1577
1577
  readonly error: undefined;
1578
1578
  }
1579
- interface Err<T$1> extends TaskOutcome<T$1> {
1579
+ interface Err<T> extends TaskOutcome<T> {
1580
1580
  readonly _tag: "Err";
1581
1581
  readonly value: undefined;
1582
1582
  readonly error: Throwable;
1583
1583
  }
1584
- type TaskSuccess<T$1> = Ok<T$1>;
1585
- type TaskFailure<T$1> = Err<T$1>;
1584
+ type TaskSuccess<T> = Ok<T>;
1585
+ type TaskFailure<T> = Err<T>;
1586
1586
  /**
1587
1587
  * Err constructor - Creates a failed TaskOutcome
1588
1588
  * @param error - The error object
1589
1589
  * @param data - Additional data related to the error
1590
1590
  * @param params - Task parameters
1591
1591
  */
1592
- declare const Err: <T$1>(error: unknown, data?: unknown, params?: TaskParams) => Err<T$1>;
1592
+ declare const Err: <T>(error: unknown, data?: unknown, params?: TaskParams) => Err<T>;
1593
1593
  /**
1594
1594
  * Ok constructor - Creates a successful TaskOutcome
1595
1595
  * @param data - The successful value
1596
1596
  * @param params - Task parameters
1597
1597
  */
1598
- declare const Ok: <T$1>(data: T$1, params?: TaskParams) => Ok<T$1>;
1599
- type TaskResult<T$1> = Promise<TaskOutcome<T$1>>;
1598
+ declare const Ok: <T>(data: T, params?: TaskParams) => Ok<T>;
1599
+ type TaskResult<T> = Promise<TaskOutcome<T>>;
1600
1600
  /**
1601
1601
  * The CancellationToken is a control structure that allows long-running tasks to be cancelled
1602
1602
  * Cancellation is cooperative, meaning the task must check the token and respond to cancellation requests
@@ -1624,9 +1624,9 @@ type CancellationTokenSource = {
1624
1624
  * @returns A CancellationTokenSource that can be used to create and control cancellation tokens
1625
1625
  */
1626
1626
  declare const createCancellationTokenSource: () => CancellationTokenSource;
1627
- type Sync<T$1> = TaskOutcome<T$1>;
1628
- type Async<T$1> = TaskResult<T$1>;
1629
- declare const Task: (<T$1 = unknown>(params?: TaskParams) => {
1627
+ type Sync<T> = TaskOutcome<T>;
1628
+ type Async<T> = TaskResult<T>;
1629
+ declare const Task$1: (<T = unknown>(params?: TaskParams) => {
1630
1630
  _type: string;
1631
1631
  /**
1632
1632
  * Run an async operation with explicit try/catch/finally semantics
@@ -1637,7 +1637,7 @@ declare const Task: (<T$1 = unknown>(params?: TaskParams) => {
1637
1637
  * @param f - Optional finally handler function
1638
1638
  * @param cancellationToken - Optional token for cancellation support
1639
1639
  */
1640
- Async: <U = T$1>(t: () => U | Promise<U> | TaskOutcome<U> | Promise<TaskOutcome<U>>, e?: (error: unknown) => unknown | TaskOutcome<U>, f?: () => Promise<void> | void, cancellationToken?: CancellationToken) => FPromise<TaskOutcome<U>>;
1640
+ Async: <U = T>(t: () => U | Promise<U> | TaskOutcome<U> | Promise<TaskOutcome<U>>, e?: (error: unknown) => unknown | TaskOutcome<U>, f?: () => Promise<void> | void, cancellationToken?: CancellationToken) => FPromise<TaskOutcome<U>>;
1641
1641
  /**
1642
1642
  * Run a synchronous operation with explicit try/catch/finally semantics
1643
1643
  * Returns a TaskOutcome for functional error handling
@@ -1646,7 +1646,7 @@ declare const Task: (<T$1 = unknown>(params?: TaskParams) => {
1646
1646
  * @param e - Optional error handler function
1647
1647
  * @param f - Optional finally handler function
1648
1648
  */
1649
- Sync: <U = T$1>(t: () => U, e?: (error: unknown) => unknown, f?: () => void) => TaskOutcome<U>;
1649
+ Sync: <U = T>(t: () => U, e?: (error: unknown) => unknown, f?: () => void) => TaskOutcome<U>;
1650
1650
  /**
1651
1651
  * Run an async operation with progress tracking capabilities
1652
1652
  * Returns a Promise and provides progress updates via callback
@@ -1657,7 +1657,7 @@ declare const Task: (<T$1 = unknown>(params?: TaskParams) => {
1657
1657
  * @param f - Optional finally handler function
1658
1658
  * @param cancellationToken - Optional token for cancellation support
1659
1659
  */
1660
- AsyncWithProgress: <U = T$1>(t: (updateProgress: (percent: number) => void) => U | Promise<U> | TaskOutcome<U> | Promise<TaskOutcome<U>>, onProgress: (percent: number) => void, e?: (error: unknown) => unknown | TaskOutcome<U>, f?: () => Promise<void> | void, cancellationToken?: CancellationToken) => FPromise<TaskOutcome<U>>;
1660
+ AsyncWithProgress: <U = T>(t: (updateProgress: (percent: number) => void) => U | Promise<U> | TaskOutcome<U> | Promise<TaskOutcome<U>>, onProgress: (percent: number) => void, e?: (error: unknown) => unknown | TaskOutcome<U>, f?: () => Promise<void> | void, cancellationToken?: CancellationToken) => FPromise<TaskOutcome<U>>;
1661
1661
  toString(): string;
1662
1662
  doUnwrap(): DoResult<unknown>;
1663
1663
  _tag: string;
@@ -1665,33 +1665,33 @@ declare const Task: (<T$1 = unknown>(params?: TaskParams) => {
1665
1665
  /**
1666
1666
  * Create a successful Task result
1667
1667
  */
1668
- success: <T$1>(data: T$1, params?: TaskParams) => Ok<T$1>;
1668
+ success: <T>(data: T, params?: TaskParams) => Ok<T>;
1669
1669
  /**
1670
1670
  * Create a failed Task result
1671
1671
  */
1672
- fail: <T$1>(error: unknown, data?: unknown, params?: TaskParams) => Err<T$1>;
1672
+ fail: <T>(error: unknown, data?: unknown, params?: TaskParams) => Err<T>;
1673
1673
  /**
1674
1674
  * Create a successful Task result (alias for success)
1675
1675
  * Preferred for new code
1676
1676
  */
1677
- ok: <T$1>(data: T$1, params?: TaskParams) => Ok<T$1>;
1677
+ ok: <T>(data: T, params?: TaskParams) => Ok<T>;
1678
1678
  /**
1679
1679
  * Create a failed Task result (alias for fail)
1680
1680
  * Preferred for new code
1681
1681
  */
1682
- err: <T$1>(error: unknown, data?: unknown, params?: TaskParams) => Err<T$1>;
1682
+ err: <T>(error: unknown, data?: unknown, params?: TaskParams) => Err<T>;
1683
1683
  /**
1684
1684
  * Create TaskOutcome from Either
1685
1685
  * @param either - Either to convert
1686
1686
  * @param params - Task parameters
1687
1687
  */
1688
- fromEither: <T$1>(either: Either<Throwable, T$1>, params?: TaskParams) => TaskOutcome<T$1>;
1688
+ fromEither: <T>(either: Either<Throwable, T>, params?: TaskParams) => TaskOutcome<T>;
1689
1689
  /**
1690
1690
  * Create TaskOutcome from Try
1691
1691
  * @param tryValue - Try to convert
1692
1692
  * @param params - Task parameters
1693
1693
  */
1694
- fromTry: <T$1>(tryValue: Try<T$1>, params?: TaskParams) => TaskOutcome<T$1>;
1694
+ fromTry: <T>(tryValue: Try<T>, params?: TaskParams) => TaskOutcome<T>;
1695
1695
  /**
1696
1696
  * Extract the error chain from a Throwable error
1697
1697
  * Returns an array of errors from outermost to innermost
@@ -1729,7 +1729,7 @@ declare const Task: (<T$1 = unknown>(params?: TaskParams) => {
1729
1729
  * @param params - Task parameters for the race operation
1730
1730
  * @returns A promise that resolves with the first task to complete or rejects if all tasks fail
1731
1731
  */
1732
- race: <T$1>(tasks: Array<FPromise<T$1> | FPromise<TaskOutcome<T$1>>>, timeoutMs?: number, params?: TaskParams) => FPromise<TaskOutcome<T$1>>;
1732
+ race: <T>(tasks: Array<FPromise<T> | FPromise<TaskOutcome<T>>>, timeoutMs?: number, params?: TaskParams) => FPromise<TaskOutcome<T>>;
1733
1733
  /**
1734
1734
  * Convert a Node.js style callback function to a Task-compatible function
1735
1735
  * Node.js callbacks typically have the signature (error, result) => void
@@ -1738,7 +1738,7 @@ declare const Task: (<T$1 = unknown>(params?: TaskParams) => {
1738
1738
  * @param params - Task parameters
1739
1739
  * @returns A function that returns an FPromise
1740
1740
  */
1741
- fromNodeCallback: <T$1, Args extends unknown[]>(nodeFn: (...args: [...Args, (error: unknown, result: T$1) => void]) => void, params?: TaskParams) => ((...args: Args) => FPromise<TaskOutcome<T$1>>);
1741
+ fromNodeCallback: <T, Args extends unknown[]>(nodeFn: (...args: [...Args, (error: unknown, result: T) => void]) => void, params?: TaskParams) => ((...args: Args) => FPromise<TaskOutcome<T>>);
1742
1742
  /**
1743
1743
  * Create a cancellation token source
1744
1744
  * @returns A cancellation token source that can be used to control task cancellation
@@ -1751,8 +1751,8 @@ declare const Task: (<T$1 = unknown>(params?: TaskParams) => {
1751
1751
  * @param params - Task parameters
1752
1752
  * @returns An object with the task and a function to cancel it
1753
1753
  */
1754
- cancellable: <T$1>(task: (token: CancellationToken) => Promise<T$1> | Promise<TaskOutcome<T$1>>, params?: TaskParams) => {
1755
- task: FPromise<TaskOutcome<T$1>>;
1754
+ cancellable: <T>(task: (token: CancellationToken) => Promise<T> | Promise<TaskOutcome<T>>, params?: TaskParams) => {
1755
+ task: FPromise<TaskOutcome<T>>;
1756
1756
  cancel: () => void;
1757
1757
  };
1758
1758
  /**
@@ -1763,13 +1763,13 @@ declare const Task: (<T$1 = unknown>(params?: TaskParams) => {
1763
1763
  * @param params - Task parameters
1764
1764
  * @returns An object with the task, cancel function, and current progress
1765
1765
  */
1766
- withProgress: <T$1>(task: (updateProgress: (percent: number) => void, token: CancellationToken) => Promise<T$1> | Promise<TaskOutcome<T$1>>, onProgress?: (percent: number) => void, params?: TaskParams) => {
1767
- task: FPromise<TaskOutcome<T$1>>;
1766
+ withProgress: <T>(task: (updateProgress: (percent: number) => void, token: CancellationToken) => Promise<T> | Promise<TaskOutcome<T>>, onProgress?: (percent: number) => void, params?: TaskParams) => {
1767
+ task: FPromise<TaskOutcome<T>>;
1768
1768
  cancel: () => void;
1769
1769
  currentProgress: () => number;
1770
1770
  };
1771
1771
  };
1772
- type Task = ReturnType<typeof Task>;
1772
+ type Task$1 = ReturnType<typeof Task$1>;
1773
1773
  //#endregion
1774
1774
  //#region src/error/ErrorFormatter.d.ts
1775
1775
  /**
@@ -1856,64 +1856,64 @@ type ErrorCode = "VALIDATION_FAILED" | "NETWORK_ERROR" | "AUTH_REQUIRED" | "NOT_
1856
1856
  /**
1857
1857
  * Template literal type for error messages based on error code
1858
1858
  */
1859
- type ErrorMessage<T$1 extends ErrorCode> = T$1 extends "VALIDATION_FAILED" ? `Validation failed: ${string}` : T$1 extends "NETWORK_ERROR" ? `Network error: ${string}` : T$1 extends "AUTH_REQUIRED" ? `Authentication required: ${string}` : T$1 extends "NOT_FOUND" ? `Not found: ${string}` : T$1 extends "PERMISSION_DENIED" ? `Permission denied: ${string}` : T$1 extends "RATE_LIMITED" ? `Rate limit exceeded: ${string}` : T$1 extends "INTERNAL_ERROR" ? `Internal server error: ${string}` : T$1 extends "BAD_REQUEST" ? `Bad request: ${string}` : T$1 extends "CONFLICT" ? `Conflict: ${string}` : T$1 extends "TIMEOUT" ? `Request timeout: ${string}` : never;
1859
+ type ErrorMessage<T extends ErrorCode> = T extends "VALIDATION_FAILED" ? `Validation failed: ${string}` : T extends "NETWORK_ERROR" ? `Network error: ${string}` : T extends "AUTH_REQUIRED" ? `Authentication required: ${string}` : T extends "NOT_FOUND" ? `Not found: ${string}` : T extends "PERMISSION_DENIED" ? `Permission denied: ${string}` : T extends "RATE_LIMITED" ? `Rate limit exceeded: ${string}` : T extends "INTERNAL_ERROR" ? `Internal server error: ${string}` : T extends "BAD_REQUEST" ? `Bad request: ${string}` : T extends "CONFLICT" ? `Conflict: ${string}` : T extends "TIMEOUT" ? `Request timeout: ${string}` : never;
1860
1860
  /**
1861
1861
  * HTTP status codes mapped to error codes
1862
1862
  */
1863
- type ErrorStatus<T$1 extends ErrorCode> = T$1 extends "VALIDATION_FAILED" | "BAD_REQUEST" ? 400 : T$1 extends "AUTH_REQUIRED" ? 401 : T$1 extends "PERMISSION_DENIED" ? 403 : T$1 extends "NOT_FOUND" ? 404 : T$1 extends "CONFLICT" ? 409 : T$1 extends "RATE_LIMITED" ? 429 : T$1 extends "TIMEOUT" ? 408 : T$1 extends "INTERNAL_ERROR" ? 500 : T$1 extends "NETWORK_ERROR" ? 503 : 500;
1863
+ type ErrorStatus<T extends ErrorCode> = T extends "VALIDATION_FAILED" | "BAD_REQUEST" ? 400 : T extends "AUTH_REQUIRED" ? 401 : T extends "PERMISSION_DENIED" ? 403 : T extends "NOT_FOUND" ? 404 : T extends "CONFLICT" ? 409 : T extends "RATE_LIMITED" ? 429 : T extends "TIMEOUT" ? 408 : T extends "INTERNAL_ERROR" ? 500 : T extends "NETWORK_ERROR" ? 503 : 500;
1864
1864
  /**
1865
1865
  * Context type for each error code
1866
1866
  */
1867
- type TypedErrorContext<T$1 extends ErrorCode> = T$1 extends "VALIDATION_FAILED" ? {
1867
+ type TypedErrorContext<T extends ErrorCode> = T extends "VALIDATION_FAILED" ? {
1868
1868
  field: string;
1869
1869
  value: unknown;
1870
1870
  rule: string;
1871
- } : T$1 extends "NETWORK_ERROR" ? {
1871
+ } : T extends "NETWORK_ERROR" ? {
1872
1872
  url: string;
1873
1873
  method: string;
1874
1874
  statusCode?: number;
1875
- } : T$1 extends "AUTH_REQUIRED" ? {
1875
+ } : T extends "AUTH_REQUIRED" ? {
1876
1876
  resource: string;
1877
1877
  requiredRole?: string;
1878
- } : T$1 extends "NOT_FOUND" ? {
1878
+ } : T extends "NOT_FOUND" ? {
1879
1879
  resource: string;
1880
1880
  id: string | number;
1881
- } : T$1 extends "PERMISSION_DENIED" ? {
1881
+ } : T extends "PERMISSION_DENIED" ? {
1882
1882
  action: string;
1883
1883
  resource: string;
1884
1884
  userId?: string;
1885
- } : T$1 extends "RATE_LIMITED" ? {
1885
+ } : T extends "RATE_LIMITED" ? {
1886
1886
  limit: number;
1887
1887
  window: string;
1888
1888
  retryAfter?: number;
1889
- } : T$1 extends "INTERNAL_ERROR" ? {
1889
+ } : T extends "INTERNAL_ERROR" ? {
1890
1890
  errorId: string;
1891
1891
  timestamp: string;
1892
- } : T$1 extends "BAD_REQUEST" ? {
1892
+ } : T extends "BAD_REQUEST" ? {
1893
1893
  reason: string;
1894
1894
  expected?: string;
1895
- } : T$1 extends "CONFLICT" ? {
1895
+ } : T extends "CONFLICT" ? {
1896
1896
  resource: string;
1897
1897
  conflictingValue: string;
1898
- } : T$1 extends "TIMEOUT" ? {
1898
+ } : T extends "TIMEOUT" ? {
1899
1899
  duration: number;
1900
1900
  operation: string;
1901
1901
  } : Record<string, unknown>;
1902
1902
  /**
1903
1903
  * Type-safe error class with template literal types
1904
1904
  */
1905
- interface TypedError<T$1 extends ErrorCode> extends Throwable {
1906
- readonly code: T$1;
1907
- readonly message: ErrorMessage<T$1>;
1908
- readonly status: ErrorStatus<T$1>;
1909
- readonly context: TypedErrorContext<T$1>;
1905
+ interface TypedError<T extends ErrorCode> extends Throwable {
1906
+ readonly code: T;
1907
+ readonly message: ErrorMessage<T>;
1908
+ readonly status: ErrorStatus<T>;
1909
+ readonly context: TypedErrorContext<T>;
1910
1910
  readonly timestamp: string;
1911
1911
  readonly traceId?: string;
1912
1912
  }
1913
- declare const TypedError: (<T$1 extends ErrorCode>(code: T$1, message: ErrorMessage<T$1>, context: TypedErrorContext<T$1>, options?: {
1913
+ declare const TypedError: (<T extends ErrorCode>(code: T, message: ErrorMessage<T>, context: TypedErrorContext<T>, options?: {
1914
1914
  cause?: unknown;
1915
1915
  traceId?: string;
1916
- }) => TypedError<T$1>) & {
1916
+ }) => TypedError<T>) & {
1917
1917
  /**
1918
1918
  * Create a validation error
1919
1919
  * @example
@@ -1992,7 +1992,7 @@ declare const TypedError: (<T$1 extends ErrorCode>(code: T$1, message: ErrorMess
1992
1992
  /**
1993
1993
  * Check if a TypedError has a specific code
1994
1994
  */
1995
- hasCode: <T$1 extends ErrorCode>(error: TypedError<ErrorCode>, code: T$1) => error is TypedError<T$1>;
1995
+ hasCode: <T extends ErrorCode>(error: TypedError<ErrorCode>, code: T) => error is TypedError<T>;
1996
1996
  };
1997
1997
  //#endregion
1998
1998
  //#region src/error/typed/Validation.d.ts
@@ -2003,20 +2003,20 @@ type ValidationRule = `min:${number}` | `max:${number}` | `minLength:${number}`
2003
2003
  /**
2004
2004
  * Validator function type
2005
2005
  */
2006
- type Validator<T$1> = (value: unknown) => Either<TypedError<"VALIDATION_FAILED">, T$1>;
2006
+ type Validator<T> = (value: unknown) => Either<TypedError<"VALIDATION_FAILED">, T>;
2007
2007
  /**
2008
2008
  * Field validation result
2009
2009
  */
2010
- type FieldValidation<T$1> = {
2010
+ type FieldValidation<T> = {
2011
2011
  field: string;
2012
2012
  value: unknown;
2013
- result: Either<TypedError<"VALIDATION_FAILED">, T$1>;
2013
+ result: Either<TypedError<"VALIDATION_FAILED">, T>;
2014
2014
  };
2015
2015
  /**
2016
2016
  * Form validation result
2017
2017
  */
2018
- type FormValidation<T$1 extends Record<string, Type>> = Either<List<TypedError<"VALIDATION_FAILED">>, T$1>;
2019
- declare const Validation: (<T$1 extends Type>(rule: ValidationRule) => Validator<T$1>) & {
2018
+ type FormValidation<T extends Record<string, Type>> = Either<List<TypedError<"VALIDATION_FAILED">>, T>;
2019
+ declare const Validation: (<T extends Type>(rule: ValidationRule) => Validator<T>) & {
2020
2020
  /**
2021
2021
  * Common pre-built validators
2022
2022
  */
@@ -2036,7 +2036,7 @@ declare const Validation: (<T$1 extends Type>(rule: ValidationRule) => Validator
2036
2036
  * const result = validator(25) // Right(25)
2037
2037
  * const error = validator(15) // Left(TypedError)
2038
2038
  */
2039
- rule: <T$1 extends Type>(rule: ValidationRule) => Validator<T$1>;
2039
+ rule: <T extends Type>(rule: ValidationRule) => Validator<T>;
2040
2040
  /**
2041
2041
  * Combine multiple validators
2042
2042
  * @example
@@ -2046,7 +2046,7 @@ declare const Validation: (<T$1 extends Type>(rule: ValidationRule) => Validator
2046
2046
  * Validation.rule<string>("maxLength:100")
2047
2047
  * )
2048
2048
  */
2049
- combine: <T$1 extends Type>(...validators: Validator<T$1>[]) => Validator<T$1>;
2049
+ combine: <T extends Type>(...validators: Validator<T>[]) => Validator<T>;
2050
2050
  /**
2051
2051
  * Create a custom validator
2052
2052
  * @example
@@ -2055,7 +2055,7 @@ declare const Validation: (<T$1 extends Type>(rule: ValidationRule) => Validator
2055
2055
  * "must be an even number"
2056
2056
  * )
2057
2057
  */
2058
- custom: <T$1 extends Type>(predicate: (value: unknown) => boolean, errorMessage: string) => Validator<T$1>;
2058
+ custom: <T extends Type>(predicate: (value: unknown) => boolean, errorMessage: string) => Validator<T>;
2059
2059
  /**
2060
2060
  * Validate a form with multiple fields
2061
2061
  * @example
@@ -2066,7 +2066,7 @@ declare const Validation: (<T$1 extends Type>(rule: ValidationRule) => Validator
2066
2066
  * }
2067
2067
  * const result = Validation.form(schema, { name: "John", email: "john@example.com", age: 25 })
2068
2068
  */
2069
- form: <T$1 extends Record<string, Type>>(schema: { [K in keyof T$1]: Validator<T$1[K]> }, data: Record<string, unknown>) => FormValidation<T$1>;
2069
+ form: <T extends Record<string, Type>>(schema: { [K in keyof T]: Validator<T[K]> }, data: Record<string, unknown>) => FormValidation<T>;
2070
2070
  };
2071
2071
  //#endregion
2072
2072
  //#region src/foldable/index.d.ts
@@ -2128,8 +2128,8 @@ type TryKind = <A>(a: A) => Try<A>;
2128
2128
  * Generic container types for type-safe operations
2129
2129
  * @internal
2130
2130
  */
2131
- type Mappable<T$1> = {
2132
- map<U>(f: (value: T$1) => U): unknown;
2131
+ type Mappable<T> = {
2132
+ map<U>(f: (value: T) => U): unknown;
2133
2133
  };
2134
2134
  /**
2135
2135
  * @internal
@@ -2140,8 +2140,8 @@ type Flattenable = {
2140
2140
  /**
2141
2141
  * @internal
2142
2142
  */
2143
- type FlatMappable<T$1> = {
2144
- flatMap<U>(f: (value: T$1) => unknown): unknown;
2143
+ type FlatMappable<T> = {
2144
+ flatMap<U>(f: (value: T) => unknown): unknown;
2145
2145
  };
2146
2146
  /**
2147
2147
  * Universal type that includes all potential return types from the HKT functions
@@ -2170,30 +2170,1386 @@ declare const HKT: {
2170
2170
  ap<F = unknown, A = unknown, B = unknown>(ff: unknown, fa: unknown): unknown;
2171
2171
  sequence<F = unknown, G = unknown, A = unknown>(fga: unknown): unknown;
2172
2172
  traverse<F = unknown, G = unknown, A = unknown, B = unknown>(fa: unknown, f: (a: A) => unknown): unknown;
2173
- isOption: <T$1 extends Type>(value: unknown) => value is Option<T$1> & Mappable<T$1> & FlatMappable<T$1>;
2174
- isList: <T$1 extends Type>(value: unknown) => value is List<T$1> & Mappable<T$1> & Flattenable & FlatMappable<T$1>;
2173
+ isOption: <T extends Type>(value: unknown) => value is Option<T> & Mappable<T> & FlatMappable<T>;
2174
+ isList: <T extends Type>(value: unknown) => value is List<T> & Mappable<T> & Flattenable & FlatMappable<T>;
2175
2175
  isEither: <E extends Type, A extends Type>(value: unknown) => value is Either<E, A> & Mappable<A> & FlatMappable<A>;
2176
- isTry: <T$1 extends Type>(value: unknown) => value is Try<T$1> & Mappable<T$1> & FlatMappable<T$1>;
2176
+ isTry: <T extends Type>(value: unknown) => value is Try<T> & Mappable<T> & FlatMappable<T>;
2177
2177
  };
2178
2178
  //#endregion
2179
2179
  //#region src/identity/Identity.d.ts
2180
- type Identity<T$1> = {
2181
- id: T$1;
2182
- isSame?: (other: Identity<T$1>) => boolean;
2180
+ type Identity<T> = {
2181
+ id: T;
2182
+ isSame?: (other: Identity<T>) => boolean;
2183
2183
  };
2184
- declare const Identity: (<T$1>(value: T$1) => Identity<T$1>) & {
2184
+ declare const Identity: (<T>(value: T) => Identity<T>) & {
2185
2185
  /**
2186
2186
  * Creates an Identity. Alias for Identity constructor.
2187
2187
  * @param value - The value to wrap
2188
2188
  * @returns Identity instance
2189
2189
  */
2190
- of: <T$1>(value: T$1) => Identity<T$1>;
2190
+ of: <T>(value: T) => Identity<T>;
2191
2191
  /**
2192
2192
  * Creates an Identity. Same as of.
2193
2193
  * @param value - The value to wrap
2194
2194
  * @returns Identity instance
2195
2195
  */
2196
- pure: <T$1>(value: T$1) => Identity<T$1>;
2196
+ pure: <T>(value: T) => Identity<T>;
2197
+ };
2198
+ //#endregion
2199
+ //#region src/io/Tag.d.ts
2200
+ /**
2201
+ * Tag module - service identifiers for dependency injection.
2202
+ * @module Tag
2203
+ * @category IO
2204
+ *
2205
+ * Tags are used to identify services in a type-safe way.
2206
+ * Each Tag has a unique identifier and carries the type of the service.
2207
+ */
2208
+ /**
2209
+ * A Tag identifies a service type and provides a unique identifier.
2210
+ * Used for dependency injection with IO effects.
2211
+ *
2212
+ * @typeParam S - The service type this tag identifies
2213
+ *
2214
+ * @example
2215
+ * ```typescript
2216
+ * // Define service interfaces
2217
+ * interface UserService {
2218
+ * getUser(id: string): IO<never, Error, User>
2219
+ * }
2220
+ *
2221
+ * // Create a tag for the service
2222
+ * const UserService = Tag<UserService>("UserService")
2223
+ *
2224
+ * // Use in effects
2225
+ * const getUser = (id: string) =>
2226
+ * IO.service(UserService).flatMap(svc => svc.getUser(id))
2227
+ * ```
2228
+ */
2229
+ interface Tag<S extends Type> {
2230
+ /**
2231
+ * Unique identifier for this tag
2232
+ */
2233
+ readonly id: string;
2234
+ /**
2235
+ * Phantom type to carry the service type
2236
+ * @internal
2237
+ */
2238
+ readonly _S?: S;
2239
+ /**
2240
+ * Type brand to distinguish tags
2241
+ * @internal
2242
+ */
2243
+ readonly _tag: "Tag";
2244
+ /**
2245
+ * String representation
2246
+ */
2247
+ toString(): string;
2248
+ }
2249
+ /**
2250
+ * Creates a Tag for identifying a service type.
2251
+ *
2252
+ * @param id - Unique identifier for this tag (usually the service name)
2253
+ * @returns A Tag that can be used to request the service
2254
+ *
2255
+ * @example
2256
+ * ```typescript
2257
+ * interface Logger {
2258
+ * log(message: string): void
2259
+ * }
2260
+ *
2261
+ * const Logger = Tag<Logger>("Logger")
2262
+ *
2263
+ * // Now Logger can be used to request the Logger service
2264
+ * const program = IO.service(Logger).flatMap(logger =>
2265
+ * IO.sync(() => logger.log("Hello!"))
2266
+ * )
2267
+ * ```
2268
+ */
2269
+ declare const Tag: <S extends Type>(id: string) => Tag<S>;
2270
+ /**
2271
+ * Type helper to extract the service type from a Tag
2272
+ */
2273
+ type TagService<T> = T extends Tag<infer S> ? S : never;
2274
+ //#endregion
2275
+ //#region src/io/Context.d.ts
2276
+ /**
2277
+ * Context module - service container for dependency injection.
2278
+ * @module Context
2279
+ * @category IO
2280
+ *
2281
+ * Context is an immutable container that holds service implementations
2282
+ * identified by their Tags.
2283
+ */
2284
+ /**
2285
+ * Context holds service implementations for dependency injection.
2286
+ * It's an immutable container that maps Tags to their implementations.
2287
+ *
2288
+ * @typeParam R - The services contained in this context (intersection type)
2289
+ *
2290
+ * @example
2291
+ * ```typescript
2292
+ * const ctx = Context.empty()
2293
+ * .add(Logger, consoleLogger)
2294
+ * .add(Database, pgDatabase)
2295
+ *
2296
+ * // Access a service
2297
+ * const logger = ctx.get(Logger) // Option<Logger>
2298
+ * const loggerUnsafe = ctx.unsafeGet(Logger) // Logger (throws if missing)
2299
+ * ```
2300
+ */
2301
+ interface Context<R$1 extends Type> {
2302
+ /**
2303
+ * Type brand
2304
+ * @internal
2305
+ */
2306
+ readonly _tag: "Context";
2307
+ /**
2308
+ * Phantom type for requirements
2309
+ * @internal
2310
+ */
2311
+ readonly _R?: R$1;
2312
+ /**
2313
+ * Internal service map
2314
+ * @internal
2315
+ */
2316
+ readonly services: ReadonlyMap<string, Type>;
2317
+ /**
2318
+ * Gets a service from the context.
2319
+ * @param tag - The tag identifying the service
2320
+ * @returns Some(service) if found, None otherwise
2321
+ */
2322
+ get<S extends Type>(tag: Tag<S>): Option<S>;
2323
+ /**
2324
+ * Gets a service from the context, throwing if not found.
2325
+ * @param tag - The tag identifying the service
2326
+ * @returns The service
2327
+ * @throws Error if service not found
2328
+ */
2329
+ unsafeGet<S extends Type>(tag: Tag<S>): S;
2330
+ /**
2331
+ * Checks if a service exists in the context.
2332
+ * @param tag - The tag to check
2333
+ * @returns true if the service exists
2334
+ */
2335
+ has<S extends Type>(tag: Tag<S>): boolean;
2336
+ /**
2337
+ * Adds a service to the context, returning a new context.
2338
+ * @param tag - The tag for the service
2339
+ * @param service - The service implementation
2340
+ * @returns A new context with the service added
2341
+ */
2342
+ add<S extends Type>(tag: Tag<S>, service: S): Context<R$1 & S>;
2343
+ /**
2344
+ * Merges another context into this one.
2345
+ * @param other - The context to merge
2346
+ * @returns A new context with all services from both
2347
+ */
2348
+ merge<R2 extends Type>(other: Context<R2>): Context<R$1 & R2>;
2349
+ /**
2350
+ * Returns the number of services in this context.
2351
+ */
2352
+ readonly size: number;
2353
+ /**
2354
+ * String representation
2355
+ */
2356
+ toString(): string;
2357
+ }
2358
+ /**
2359
+ * Context companion object with utility methods
2360
+ */
2361
+ declare const Context: {
2362
+ /**
2363
+ * Creates an empty context with no services.
2364
+ */
2365
+ empty: <R$1 extends Type = never>() => Context<R$1>;
2366
+ /**
2367
+ * Creates a context with a single service.
2368
+ * @param tag - The tag for the service
2369
+ * @param service - The service implementation
2370
+ */
2371
+ make: <S extends Type>(tag: Tag<S>, service: S) => Context<S>;
2372
+ /**
2373
+ * Checks if a value is a Context.
2374
+ */
2375
+ isContext: <R$1 extends Type>(value: unknown) => value is Context<R$1>;
2376
+ };
2377
+ /**
2378
+ * Type helper to extract requirements from a Context
2379
+ */
2380
+ type ContextServices<C> = C extends Context<infer R> ? R : never;
2381
+ /**
2382
+ * Type helper to check if a context provides a service
2383
+ */
2384
+ type HasService<C, S> = S extends ContextServices<C> ? true : false;
2385
+ //#endregion
2386
+ //#region src/io/Exit.d.ts
2387
+ /**
2388
+ * Exit type module - represents the outcome of running an IO effect.
2389
+ * @module Exit
2390
+ * @category IO
2391
+ */
2392
+ /**
2393
+ * Possible outcome types for an Exit
2394
+ */
2395
+ type ExitTag = "Success" | "Failure" | "Interrupted";
2396
+ /**
2397
+ * Exit represents the outcome of running an IO effect.
2398
+ * - Success: The effect completed successfully with a value
2399
+ * - Failure: The effect failed with a typed error
2400
+ * - Interrupted: The effect was cancelled/interrupted
2401
+ */
2402
+ interface Exit<E extends Type, A extends Type> {
2403
+ readonly _tag: ExitTag;
2404
+ /**
2405
+ * Type guard to check if this is a Success
2406
+ */
2407
+ isSuccess(): this is Exit<E, A> & {
2408
+ readonly _tag: "Success";
2409
+ value: A;
2410
+ };
2411
+ /**
2412
+ * Type guard to check if this is a Failure
2413
+ */
2414
+ isFailure(): this is Exit<E, A> & {
2415
+ readonly _tag: "Failure";
2416
+ error: E;
2417
+ };
2418
+ /**
2419
+ * Type guard to check if this is Interrupted
2420
+ */
2421
+ isInterrupted(): this is Exit<E, A> & {
2422
+ readonly _tag: "Interrupted";
2423
+ fiberId: string;
2424
+ };
2425
+ /**
2426
+ * Maps the success value
2427
+ */
2428
+ map<B extends Type>(f: (a: A) => B): Exit<E, B>;
2429
+ /**
2430
+ * Maps the error value
2431
+ */
2432
+ mapError<E2 extends Type>(f: (e: E) => E2): Exit<E2, A>;
2433
+ /**
2434
+ * Maps both error and success values
2435
+ */
2436
+ mapBoth<E2 extends Type, B extends Type>(onError: (e: E) => E2, onSuccess: (a: A) => B): Exit<E2, B>;
2437
+ /**
2438
+ * Flat maps the success value
2439
+ */
2440
+ flatMap<B extends Type>(f: (a: A) => Exit<E, B>): Exit<E, B>;
2441
+ /**
2442
+ * Pattern matches over the Exit
2443
+ */
2444
+ fold<T>(onFailure: (e: E) => T, onSuccess: (a: A) => T, onInterrupted?: (fiberId: string) => T): T;
2445
+ /**
2446
+ * Pattern matches over the Exit with object patterns
2447
+ */
2448
+ match<T>(patterns: {
2449
+ Success: (value: A) => T;
2450
+ Failure: (error: E) => T;
2451
+ Interrupted: (fiberId: string) => T;
2452
+ }): T;
2453
+ /**
2454
+ * Returns the success value or throws
2455
+ */
2456
+ orThrow(): A;
2457
+ /**
2458
+ * Returns the success value or a default
2459
+ */
2460
+ orElse(defaultValue: A): A;
2461
+ /**
2462
+ * Converts to Option (Some for Success, None otherwise)
2463
+ */
2464
+ toOption(): Option<A>;
2465
+ /**
2466
+ * Converts to Either (Right for Success, Left for Failure)
2467
+ * Throws if Interrupted
2468
+ */
2469
+ toEither(): Either<E, A>;
2470
+ /**
2471
+ * Returns the raw value for inspection
2472
+ */
2473
+ toValue(): {
2474
+ _tag: ExitTag;
2475
+ value?: A;
2476
+ error?: E;
2477
+ fiberId?: string;
2478
+ };
2479
+ /**
2480
+ * String representation
2481
+ */
2482
+ toString(): string;
2483
+ /**
2484
+ * JSON serialization
2485
+ */
2486
+ toJSON(): {
2487
+ _tag: ExitTag;
2488
+ value?: A;
2489
+ error?: E;
2490
+ fiberId?: string;
2491
+ };
2492
+ }
2493
+ /**
2494
+ * Exit type for representing effect outcomes.
2495
+ *
2496
+ * @example
2497
+ * ```typescript
2498
+ * const success = Exit.succeed(42)
2499
+ * const failure = Exit.fail(new Error("oops"))
2500
+ * const interrupted = Exit.interrupt("fiber-123")
2501
+ *
2502
+ * success.fold(
2503
+ * (err) => console.error(err),
2504
+ * (value) => console.log(value),
2505
+ * (fiberId) => console.log("interrupted:", fiberId)
2506
+ * )
2507
+ * ```
2508
+ */
2509
+ declare const Exit: (<E extends Type, A extends Type>(value: A) => Exit<E, A>) & {
2510
+ /**
2511
+ * Creates a Success Exit
2512
+ */
2513
+ succeed: <E extends Type, A extends Type>(value: A) => Exit<E, A>;
2514
+ /**
2515
+ * Creates a Failure Exit
2516
+ */
2517
+ fail: <E extends Type, A extends Type>(error: E) => Exit<E, A>;
2518
+ /**
2519
+ * Creates an Interrupted Exit with a fiber ID
2520
+ */
2521
+ interrupt: <E extends Type, A extends Type>(fiberId: string) => Exit<E, A>;
2522
+ /**
2523
+ * Creates an Interrupted Exit with a default fiber ID
2524
+ */
2525
+ interrupted: <E extends Type, A extends Type>() => Exit<E, A>;
2526
+ /**
2527
+ * Type guard for Success
2528
+ */
2529
+ isSuccess: <E extends Type, A extends Type>(exit: Exit<E, A>) => exit is Exit<E, A> & {
2530
+ readonly _tag: "Success";
2531
+ value: A;
2532
+ };
2533
+ /**
2534
+ * Type guard for Failure
2535
+ */
2536
+ isFailure: <E extends Type, A extends Type>(exit: Exit<E, A>) => exit is Exit<E, A> & {
2537
+ readonly _tag: "Failure";
2538
+ error: E;
2539
+ };
2540
+ /**
2541
+ * Type guard for Interrupted
2542
+ */
2543
+ isInterrupted: <E extends Type, A extends Type>(exit: Exit<E, A>) => exit is Exit<E, A> & {
2544
+ readonly _tag: "Interrupted";
2545
+ fiberId: string;
2546
+ };
2547
+ /**
2548
+ * Creates an Exit from an Either
2549
+ */
2550
+ fromEither: <E extends Type, A extends Type>(either: Either<E, A>) => Exit<E, A>;
2551
+ /**
2552
+ * Creates an Exit from an Option
2553
+ */
2554
+ fromOption: <A extends Type>(option: Option<A>, onNone: () => unknown) => Exit<unknown, A>;
2555
+ /**
2556
+ * Combines two Exits, keeping the first failure or combining successes
2557
+ */
2558
+ zip: <E extends Type, A extends Type, B extends Type>(exitA: Exit<E, A>, exitB: Exit<E, B>) => Exit<E, readonly [A, B]>;
2559
+ /**
2560
+ * Collects all Exits into an Exit of array
2561
+ */
2562
+ all: <E extends Type, A extends Type>(exits: readonly Exit<E, A>[]) => Exit<E, readonly A[]>;
2563
+ };
2564
+ //#endregion
2565
+ //#region src/io/Layer.d.ts
2566
+ /**
2567
+ * Layer module - service construction recipes.
2568
+ * @module Layer
2569
+ * @category IO
2570
+ *
2571
+ * Layers describe how to construct services, including their dependencies.
2572
+ * They can be composed to build complex service graphs.
2573
+ */
2574
+ /**
2575
+ * A Layer describes how to build a service or set of services.
2576
+ *
2577
+ * @typeParam RIn - Required services (dependencies)
2578
+ * @typeParam E - Possible errors during construction
2579
+ * @typeParam ROut - Services provided by this layer
2580
+ *
2581
+ * @example
2582
+ * ```typescript
2583
+ * // A layer that provides a Logger service
2584
+ * const LoggerLive = Layer.succeed(Logger, consoleLogger)
2585
+ *
2586
+ * // A layer that requires Config and provides Database
2587
+ * const DatabaseLive = Layer.fromFunction(Database, (config: Config) =>
2588
+ * createDatabase(config.connectionString)
2589
+ * )
2590
+ * ```
2591
+ */
2592
+ interface Layer<RIn extends Type, E extends Type, ROut extends Type> {
2593
+ /**
2594
+ * Type brand
2595
+ * @internal
2596
+ */
2597
+ readonly _tag: "Layer";
2598
+ /**
2599
+ * Phantom types
2600
+ * @internal
2601
+ */
2602
+ readonly _RIn?: RIn;
2603
+ readonly _E?: E;
2604
+ readonly _ROut?: ROut;
2605
+ /**
2606
+ * The build function that creates the context
2607
+ * @internal
2608
+ */
2609
+ readonly build: (input: Context<RIn>) => Promise<Context<ROut>>;
2610
+ /**
2611
+ * Composes this layer with another, running them in sequence.
2612
+ * The output of this layer becomes available to the next layer.
2613
+ * @param that - Layer to compose with
2614
+ */
2615
+ provideToAndMerge<RIn2 extends Type, E2 extends Type, ROut2 extends Type>(that: Layer<RIn2 | ROut, E2, ROut2>): Layer<RIn | Exclude<RIn2, ROut>, E | E2, ROut | ROut2>;
2616
+ /**
2617
+ * Merges two independent layers.
2618
+ * @param that - Layer to merge with
2619
+ */
2620
+ merge<RIn2 extends Type, E2 extends Type, ROut2 extends Type>(that: Layer<RIn2, E2, ROut2>): Layer<RIn | RIn2, E | E2, ROut | ROut2>;
2621
+ /**
2622
+ * Maps the output of this layer.
2623
+ * @param f - Function to transform the output
2624
+ */
2625
+ map<ROut2 extends Type>(f: (ctx: Context<ROut>) => Context<ROut2>): Layer<RIn, E, ROut2>;
2626
+ /**
2627
+ * String representation
2628
+ */
2629
+ toString(): string;
2630
+ }
2631
+ /**
2632
+ * Layer companion object with construction methods
2633
+ */
2634
+ declare const Layer: {
2635
+ /**
2636
+ * Creates a layer that provides a service with a constant value.
2637
+ * @param tag - The service tag
2638
+ * @param service - The service implementation
2639
+ */
2640
+ succeed: <S extends Type>(tag: Tag<S>, service: S) => Layer<never, never, S>;
2641
+ /**
2642
+ * Creates a layer from an async function.
2643
+ * @param tag - The service tag
2644
+ * @param f - Async function to create the service
2645
+ */
2646
+ effect: <S extends Type, E extends Type>(tag: Tag<S>, f: () => Promise<S>) => Layer<never, E, S>;
2647
+ /**
2648
+ * Creates a layer from a sync function.
2649
+ * @param tag - The service tag
2650
+ * @param f - Function to create the service
2651
+ */
2652
+ sync: <S extends Type>(tag: Tag<S>, f: () => S) => Layer<never, never, S>;
2653
+ /**
2654
+ * Creates a layer that depends on another service.
2655
+ * @param tag - The service tag to provide
2656
+ * @param depTag - The dependency tag
2657
+ * @param f - Function to create the service from the dependency
2658
+ */
2659
+ fromService: <Dep extends Type, S extends Type>(tag: Tag<S>, depTag: Tag<Dep>, f: (dep: Dep) => S) => Layer<Dep, never, S>;
2660
+ /**
2661
+ * Creates a layer that depends on another service (async).
2662
+ * @param tag - The service tag to provide
2663
+ * @param depTag - The dependency tag
2664
+ * @param f - Async function to create the service from the dependency
2665
+ */
2666
+ fromServiceEffect: <Dep extends Type, E extends Type, S extends Type>(tag: Tag<S>, depTag: Tag<Dep>, f: (dep: Dep) => Promise<S>) => Layer<Dep, E, S>;
2667
+ /**
2668
+ * Creates a layer from a context.
2669
+ * @param context - The context to use
2670
+ */
2671
+ fromContext: <R$1 extends Type>(context: Context<R$1>) => Layer<never, never, R$1>;
2672
+ /**
2673
+ * Creates an empty layer that provides nothing.
2674
+ */
2675
+ empty: () => Layer<never, never, never>;
2676
+ /**
2677
+ * Merges multiple layers into one.
2678
+ * @param layers - Layers to merge
2679
+ */
2680
+ mergeAll: <Layers extends Layer<Type, Type, Type>[]>(...layers: Layers) => Layer<Layers[number] extends Layer<infer RIn, Type, Type> ? RIn : never, Layers[number] extends Layer<Type, infer E, Type> ? E : never, Layers[number] extends Layer<Type, Type, infer ROut> ? ROut : never>;
2681
+ };
2682
+ /**
2683
+ * Type helper to extract input requirements from a Layer
2684
+ */
2685
+ type LayerInput<L> = L extends Layer<infer RIn, Type, Type> ? RIn : never;
2686
+ /**
2687
+ * Type helper to extract error type from a Layer
2688
+ */
2689
+ type LayerError<L> = L extends Layer<Type, infer E, Type> ? E : never;
2690
+ /**
2691
+ * Type helper to extract output services from a Layer
2692
+ */
2693
+ type LayerOutput<L> = L extends Layer<Type, Type, infer ROut> ? ROut : never;
2694
+ //#endregion
2695
+ //#region src/io/IO.d.ts
2696
+ /**
2697
+ * Error thrown when an effect times out.
2698
+ */
2699
+ declare class TimeoutError extends Error {
2700
+ readonly duration: number;
2701
+ readonly _tag: "TimeoutError";
2702
+ constructor(duration: number, message?: string);
2703
+ }
2704
+ /**
2705
+ * Error thrown when an effect is interrupted.
2706
+ */
2707
+ declare class InterruptedError extends Error {
2708
+ readonly _tag: "InterruptedError";
2709
+ constructor(message?: string);
2710
+ }
2711
+ /**
2712
+ * IO Effect type module - a lazy, composable effect type with typed errors.
2713
+ * @module IO
2714
+ * @category IO
2715
+ *
2716
+ * IO<R, E, A> represents an effectful computation that:
2717
+ * - Requires environment R to run
2718
+ * - May fail with error E
2719
+ * - Produces value A on success
2720
+ *
2721
+ * Key features:
2722
+ * - Lazy execution (nothing runs until explicitly executed)
2723
+ * - Unified sync/async API
2724
+ * - Typed errors at compile time
2725
+ * - Composable via map/flatMap
2726
+ */
2727
+ /**
2728
+ * Internal effect representation types
2729
+ */
2730
+ type IOEffect<R$1, E, A> = {
2731
+ readonly _tag: "Sync";
2732
+ readonly thunk: () => A;
2733
+ } | {
2734
+ readonly _tag: "Async";
2735
+ readonly thunk: () => Promise<A>;
2736
+ } | {
2737
+ readonly _tag: "Auto";
2738
+ readonly thunk: () => A | Promise<A>;
2739
+ } | {
2740
+ readonly _tag: "Succeed";
2741
+ readonly value: A;
2742
+ } | {
2743
+ readonly _tag: "Fail";
2744
+ readonly error: E;
2745
+ } | {
2746
+ readonly _tag: "Die";
2747
+ readonly defect: unknown;
2748
+ } | {
2749
+ readonly _tag: "Interrupt";
2750
+ } | {
2751
+ readonly _tag: "FlatMap";
2752
+ readonly effect: IO<R$1, E, unknown>;
2753
+ readonly f: (a: unknown) => IO<R$1, E, A>;
2754
+ } | {
2755
+ readonly _tag: "Map";
2756
+ readonly effect: IO<R$1, E, unknown>;
2757
+ readonly f: (a: unknown) => A;
2758
+ } | {
2759
+ readonly _tag: "MapError";
2760
+ readonly effect: IO<R$1, unknown, A>;
2761
+ readonly f: (e: unknown) => E;
2762
+ } | {
2763
+ readonly _tag: "Recover";
2764
+ readonly effect: IO<R$1, E, A>;
2765
+ readonly fallback: A;
2766
+ } | {
2767
+ readonly _tag: "RecoverWith";
2768
+ readonly effect: IO<R$1, E, A>;
2769
+ readonly f: (e: E) => IO<R$1, E, A>;
2770
+ } | {
2771
+ readonly _tag: "Fold";
2772
+ readonly effect: IO<R$1, E, unknown>;
2773
+ readonly onFailure: (e: E) => A;
2774
+ readonly onSuccess: (a: unknown) => A;
2775
+ } | {
2776
+ readonly _tag: "Bracket";
2777
+ readonly acquire: IO<R$1, E, unknown>;
2778
+ readonly use: (a: unknown) => IO<R$1, E, A>;
2779
+ readonly release: (a: unknown) => IO<R$1, never, void>;
2780
+ } | {
2781
+ readonly _tag: "Race";
2782
+ readonly effects: readonly IO<R$1, E, A>[];
2783
+ } | {
2784
+ readonly _tag: "Timeout";
2785
+ readonly effect: IO<R$1, E, A>;
2786
+ readonly duration: number;
2787
+ } | {
2788
+ readonly _tag: "Service";
2789
+ readonly tag: Tag<A>;
2790
+ } | {
2791
+ readonly _tag: "ProvideContext";
2792
+ readonly effect: IO<R$1, E, A>;
2793
+ readonly context: Context<R$1>;
2794
+ };
2795
+ /**
2796
+ * IO<R, E, A> represents a lazy, composable effect.
2797
+ *
2798
+ * @typeParam R - Requirements (environment/dependencies needed to run)
2799
+ * @typeParam E - Error type (typed failures)
2800
+ * @typeParam A - Success type (value produced on success)
2801
+ */
2802
+ interface IO<R$1 extends Type, E extends Type, A extends Type> {
2803
+ /**
2804
+ * Internal effect representation
2805
+ * @internal
2806
+ */
2807
+ readonly _effect: IOEffect<R$1, E, A>;
2808
+ /**
2809
+ * Phantom type for requirements
2810
+ * @internal
2811
+ */
2812
+ readonly _R?: R$1;
2813
+ /**
2814
+ * Phantom type for error
2815
+ * @internal
2816
+ */
2817
+ readonly _E?: E;
2818
+ /**
2819
+ * Phantom type for success
2820
+ * @internal
2821
+ */
2822
+ readonly _A?: A;
2823
+ /**
2824
+ * Transforms the success value.
2825
+ * @param f - Function to apply to the success value
2826
+ * @returns New IO with transformed value
2827
+ */
2828
+ map<B extends Type>(f: (a: A) => B): IO<R$1, E, B>;
2829
+ /**
2830
+ * Chains another IO effect based on the success value.
2831
+ * @param f - Function returning next IO effect
2832
+ * @returns New IO with combined effects
2833
+ */
2834
+ flatMap<R2 extends Type, E2 extends Type, B extends Type>(f: (a: A) => IO<R2, E2, B>): IO<R$1 | R2, E | E2, B>;
2835
+ /**
2836
+ * Applies a side effect without changing the value.
2837
+ * @param f - Side effect function
2838
+ * @returns Same IO for chaining
2839
+ */
2840
+ tap(f: (a: A) => void): IO<R$1, E, A>;
2841
+ /**
2842
+ * Applies an effectful side effect without changing the value.
2843
+ * @param f - Function returning IO for side effect
2844
+ * @returns Same value after running side effect
2845
+ */
2846
+ tapEffect<R2 extends Type, E2 extends Type, B extends Type>(f: (a: A) => IO<R2, E2, B>): IO<R$1 | R2, E | E2, A>;
2847
+ /**
2848
+ * Transforms the error value.
2849
+ * @param f - Function to apply to the error
2850
+ * @returns New IO with transformed error
2851
+ */
2852
+ mapError<E2 extends Type>(f: (e: E) => E2): IO<R$1, E2, A>;
2853
+ /**
2854
+ * Executes a side effect on the error without changing it.
2855
+ * Useful for logging errors while preserving the error chain.
2856
+ *
2857
+ * @param f - Side effect function to run on error
2858
+ * @returns Same IO with the side effect attached
2859
+ *
2860
+ * @example
2861
+ * ```typescript
2862
+ * const io = IO.asyncResult(() => query(), toError)
2863
+ * .tapError(err => console.error('Query failed:', err))
2864
+ * .map(data => transform(data))
2865
+ * ```
2866
+ */
2867
+ tapError(f: (e: E) => void): IO<R$1, E, A>;
2868
+ /**
2869
+ * Recovers from any error with a fallback value.
2870
+ * @param fallback - Value to use on error
2871
+ * @returns New IO that never fails
2872
+ */
2873
+ recover<B extends Type>(fallback: B): IO<R$1, never, A | B>;
2874
+ /**
2875
+ * Recovers from error by running another effect.
2876
+ * @param f - Function returning recovery effect
2877
+ * @returns New IO with error handling
2878
+ */
2879
+ recoverWith<R2 extends Type, E2 extends Type, B extends Type>(f: (e: E) => IO<R2, E2, B>): IO<R$1 | R2, E2, A | B>;
2880
+ /**
2881
+ * Pattern matches on success and failure.
2882
+ * @param onFailure - Handler for failures
2883
+ * @param onSuccess - Handler for successes
2884
+ * @returns New IO with handled result
2885
+ */
2886
+ fold<B extends Type>(onFailure: (e: E) => B, onSuccess: (a: A) => B): IO<R$1, never, B>;
2887
+ /**
2888
+ * Pattern matches with object pattern syntax.
2889
+ */
2890
+ match<B extends Type>(patterns: {
2891
+ failure: (e: E) => B;
2892
+ success: (a: A) => B;
2893
+ }): IO<R$1, never, B>;
2894
+ /**
2895
+ * Catches errors with a specific tag and handles them.
2896
+ * @param tag - The error tag to catch
2897
+ * @param handler - Handler for the caught error
2898
+ */
2899
+ catchTag<K$1 extends (E extends {
2900
+ _tag: string;
2901
+ } ? E["_tag"] : never), R2 extends Type, E2 extends Type, B extends Type>(tag: K$1, handler: (e: Extract<E, {
2902
+ _tag: K$1;
2903
+ }>) => IO<R2, E2, B>): IO<R$1 | R2, Exclude<E, {
2904
+ _tag: K$1;
2905
+ }> | E2, A | B>;
2906
+ /**
2907
+ * Catches all errors (alias for recoverWith).
2908
+ */
2909
+ catchAll<R2 extends Type, E2 extends Type, B extends Type>(handler: (e: E) => IO<R2, E2, B>): IO<R$1 | R2, E2, A | B>;
2910
+ /**
2911
+ * Retries the effect up to n times on failure.
2912
+ * @param n - Maximum number of retries
2913
+ */
2914
+ retry(n: number): IO<R$1, E, A>;
2915
+ /**
2916
+ * Retries the effect with a delay between attempts.
2917
+ * @param n - Maximum number of retries
2918
+ * @param delayMs - Delay between retries in milliseconds
2919
+ */
2920
+ retryWithDelay(n: number, delayMs: number): IO<R$1, E, A>;
2921
+ /**
2922
+ * Sequences two IOs, keeping the second value.
2923
+ */
2924
+ zipRight<R2 extends Type, E2 extends Type, B extends Type>(that: IO<R2, E2, B>): IO<R$1 | R2, E | E2, B>;
2925
+ /**
2926
+ * Sequences two IOs, keeping the first value.
2927
+ */
2928
+ zipLeft<R2 extends Type, E2 extends Type, B extends Type>(that: IO<R2, E2, B>): IO<R$1 | R2, E | E2, A>;
2929
+ /**
2930
+ * Zips two IOs into a tuple.
2931
+ */
2932
+ zip<R2 extends Type, E2 extends Type, B extends Type>(that: IO<R2, E2, B>): IO<R$1 | R2, E | E2, readonly [A, B]>;
2933
+ /**
2934
+ * Flattens a nested IO.
2935
+ */
2936
+ flatten<R2 extends Type, E2 extends Type, B extends Type>(this: IO<R$1, E, IO<R2, E2, B>>): IO<R$1 | R2, E | E2, B>;
2937
+ /**
2938
+ * Provides a context to satisfy the requirements of this effect.
2939
+ * @param context - The context containing required services
2940
+ */
2941
+ provideContext<R2 extends R$1>(context: Context<R2>): IO<Exclude<R$1, R2>, E, A>;
2942
+ /**
2943
+ * Provides a single service to satisfy part of the requirements.
2944
+ * @param tag - The service tag
2945
+ * @param service - The service implementation
2946
+ */
2947
+ provideService<S extends Type>(tag: Tag<S>, service: S): IO<Exclude<R$1, S>, E, A>;
2948
+ /**
2949
+ * Provides services using a layer.
2950
+ * @param layer - The layer that provides services
2951
+ */
2952
+ provideLayer<RIn extends Type, E2 extends Type, ROut extends R$1>(layer: Layer<RIn, E2, ROut>): IO<RIn | Exclude<R$1, ROut>, E | E2, A>;
2953
+ /**
2954
+ * Runs the effect and returns a Promise of the value.
2955
+ * Throws on error. Requires R = never.
2956
+ */
2957
+ run(this: IO<never, E, A>): Promise<A>;
2958
+ /**
2959
+ * Runs a sync effect and returns the value.
2960
+ * Throws if the effect is async or has unmet requirements.
2961
+ */
2962
+ runSync(this: IO<never, E, A>): A;
2963
+ /**
2964
+ * Runs the effect and returns an Either.
2965
+ */
2966
+ runEither(this: IO<never, E, A>): Promise<Either<E, A>>;
2967
+ /**
2968
+ * Runs the effect and returns an Exit.
2969
+ */
2970
+ runExit(this: IO<never, E, A>): Promise<Exit<E, A>>;
2971
+ /**
2972
+ * Runs the effect and returns an Option.
2973
+ * Some(value) on success, None on failure.
2974
+ */
2975
+ runOption(this: IO<never, E, A>): Promise<Option<A>>;
2976
+ /**
2977
+ * Runs the effect and returns a Try.
2978
+ * Success(value) on success, Failure(error) on failure.
2979
+ */
2980
+ runTry(this: IO<never, E, A>): Promise<ReturnType<typeof Try<A>>>;
2981
+ /**
2982
+ * Pipes the IO through a function.
2983
+ */
2984
+ pipe<B>(f: (self: IO<R$1, E, A>) => B): B;
2985
+ /**
2986
+ * Delays execution by the specified milliseconds.
2987
+ */
2988
+ delay(ms: number): IO<R$1, E, A>;
2989
+ /**
2990
+ * Fails with TimeoutError if the effect doesn't complete within the specified duration.
2991
+ * @param ms - Maximum time in milliseconds
2992
+ */
2993
+ timeout(ms: number): IO<R$1, E | TimeoutError, A>;
2994
+ /**
2995
+ * Returns a fallback value if the effect doesn't complete within the specified duration.
2996
+ * @param ms - Maximum time in milliseconds
2997
+ * @param fallback - Value to return on timeout
2998
+ */
2999
+ timeoutTo<B extends Type>(ms: number, fallback: B): IO<R$1, E, A | B>;
3000
+ /**
3001
+ * Converts to string representation.
3002
+ */
3003
+ toString(): string;
3004
+ /**
3005
+ * Converts to JSON representation.
3006
+ */
3007
+ toJSON(): {
3008
+ _tag: string;
3009
+ effect: unknown;
3010
+ };
3011
+ /**
3012
+ * Makes IO iterable for generator do-notation (yield* syntax).
3013
+ * Yields the IO itself, allowing IO.gen to extract the value.
3014
+ */
3015
+ [Symbol.iterator](): Generator<IO<R$1, E, A>, A, A>;
3016
+ }
3017
+ /**
3018
+ * Do-builder interface for chaining binds and maps
3019
+ */
3020
+ interface DoBuilder<R$1 extends Type, E extends Type, Ctx extends Record<string, Type>> {
3021
+ /**
3022
+ * The underlying IO effect
3023
+ */
3024
+ readonly effect: IO<R$1, E, Ctx>;
3025
+ /**
3026
+ * Binds the result of an effect to a named property in the context.
3027
+ * @param name - The property name to bind to
3028
+ * @param f - Function that returns an IO effect (receives current context)
3029
+ */
3030
+ bind<N extends string, R2 extends Type, E2 extends Type, A extends Type>(name: Exclude<N, keyof Ctx>, f: (ctx: Ctx) => IO<R2, E2, A>): DoBuilder<R$1 | R2, E | E2, Ctx & Record<N, A>>;
3031
+ /**
3032
+ * Binds a pure value to a named property in the context.
3033
+ * @param name - The property name to bind to
3034
+ * @param f - Function that returns a value (receives current context)
3035
+ */
3036
+ let<N extends string, A extends Type>(name: Exclude<N, keyof Ctx>, f: (ctx: Ctx) => A): DoBuilder<R$1, E, Ctx & Record<N, A>>;
3037
+ /**
3038
+ * Transforms the final context value.
3039
+ * @param f - Function to transform the context
3040
+ */
3041
+ map<B extends Type>(f: (ctx: Ctx) => B): IO<R$1, E, B>;
3042
+ /**
3043
+ * Chains to another IO based on the context.
3044
+ * @param f - Function that returns an IO effect
3045
+ */
3046
+ flatMap<R2 extends Type, E2 extends Type, B extends Type>(f: (ctx: Ctx) => IO<R2, E2, B>): IO<R$1 | R2, E | E2, B>;
3047
+ /**
3048
+ * Executes a side effect without changing the context.
3049
+ * @param f - Side effect function
3050
+ */
3051
+ tap(f: (ctx: Ctx) => void): DoBuilder<R$1, E, Ctx>;
3052
+ /**
3053
+ * Executes an effectful side effect without changing the context.
3054
+ * @param f - Function returning an IO for the side effect
3055
+ */
3056
+ tapEffect<R2 extends Type, E2 extends Type, B extends Type>(f: (ctx: Ctx) => IO<R2, E2, B>): DoBuilder<R$1 | R2, E | E2, Ctx>;
3057
+ /**
3058
+ * Returns the final context as is.
3059
+ */
3060
+ done(): IO<R$1, E, Ctx>;
3061
+ }
3062
+ /**
3063
+ * IO effect type for lazy, composable effects with typed errors.
3064
+ *
3065
+ * @example
3066
+ * ```typescript
3067
+ * // Basic usage
3068
+ * const program = IO.sync(() => 42)
3069
+ * .map(x => x * 2)
3070
+ * .flatMap(x => IO.succeed(x + 1))
3071
+ *
3072
+ * const result = await program.run() // 85
3073
+ *
3074
+ * // Error handling
3075
+ * const safe = IO.tryPromise({
3076
+ * try: () => fetch('/api/data'),
3077
+ * catch: (e) => new NetworkError(e)
3078
+ * })
3079
+ * .map(res => res.json())
3080
+ * .recover({ fallback: 'default' })
3081
+ *
3082
+ * // Composition
3083
+ * const composed = IO.all([
3084
+ * IO.succeed(1),
3085
+ * IO.succeed(2),
3086
+ * IO.succeed(3)
3087
+ * ]) // IO<never, never, [1, 2, 3]>
3088
+ * ```
3089
+ */
3090
+ declare const IO: (<A extends Type>(f: () => A | Promise<A>) => IO<never, unknown, A>) & {
3091
+ /**
3092
+ * Creates an IO from a synchronous thunk.
3093
+ * The function is not executed until the IO is run.
3094
+ */
3095
+ sync: <A extends Type>(f: () => A) => IO<never, never, A>;
3096
+ /**
3097
+ * Creates an IO that succeeds with the given value.
3098
+ */
3099
+ succeed: <A extends Type>(value: A) => IO<never, never, A>;
3100
+ /**
3101
+ * Creates an IO that fails with the given error.
3102
+ */
3103
+ fail: <E extends Type>(error: E) => IO<never, E, never>;
3104
+ /**
3105
+ * Creates an IO that dies with an unrecoverable defect.
3106
+ */
3107
+ die: (defect: unknown) => IO<never, never, never>;
3108
+ /**
3109
+ * Creates an IO from an async thunk.
3110
+ * The Promise is not created until the IO is run.
3111
+ */
3112
+ async: <A extends Type>(f: () => Promise<A>) => IO<never, unknown, A>;
3113
+ /**
3114
+ * Creates an IO from a Promise with error handling.
3115
+ */
3116
+ tryPromise: <A extends Type, E extends Type>(opts: {
3117
+ readonly try: () => Promise<A>;
3118
+ readonly catch: (error: unknown) => E;
3119
+ }) => IO<never, E, A>;
3120
+ /**
3121
+ * Creates an IO from a function that might throw.
3122
+ */
3123
+ tryCatch: <A extends Type, E extends Type>(f: () => A, onError: (error: unknown) => E) => IO<never, E, A>;
3124
+ /**
3125
+ * Lifts a synchronous function into an IO-returning function.
3126
+ */
3127
+ liftSync: <Args extends unknown[], A extends Type>(f: (...args: Args) => A) => (...args: Args) => IO<never, never, A>;
3128
+ /**
3129
+ * Lifts a Promise-returning function into an IO-returning function.
3130
+ */
3131
+ liftPromise: <Args extends unknown[], A extends Type>(f: (...args: Args) => Promise<A>) => (...args: Args) => IO<never, unknown, A>;
3132
+ /**
3133
+ * Creates an IO from an Either.
3134
+ */
3135
+ fromEither: <E extends Type, A extends Type>(either: Either<E, A>) => IO<never, E, A>;
3136
+ /**
3137
+ * Creates an IO from an Option.
3138
+ */
3139
+ fromOption: <A extends Type>(option: Option<A>) => IO<never, void, A>;
3140
+ /**
3141
+ * Creates an IO from an Option with custom error.
3142
+ */
3143
+ fromOptionOrFail: <E extends Type, A extends Type>(option: Option<A>, onNone: () => E) => IO<never, E, A>;
3144
+ /**
3145
+ * Creates an IO from a Try.
3146
+ */
3147
+ fromTry: <A extends Type>(t: ReturnType<typeof Try<A>>) => IO<never, Error, A>;
3148
+ /**
3149
+ * Creates an IO from a result object with data/error pattern.
3150
+ * If error is present (truthy), fails with the error.
3151
+ * Otherwise succeeds with Option-wrapped data (None if data is null/undefined).
3152
+ *
3153
+ * This handles the common `{ data, error }` response pattern used by
3154
+ * Supabase, many REST APIs, and similar libraries.
3155
+ *
3156
+ * @example
3157
+ * ```typescript
3158
+ * const response = { data: user, error: null }
3159
+ * const io = IO.fromResult(response) // IO<never, null, Option<User>> -> Some(user)
3160
+ *
3161
+ * const emptyResponse = { data: null, error: null }
3162
+ * const emptyIo = IO.fromResult(emptyResponse) // IO<never, null, Option<User>> -> None
3163
+ *
3164
+ * const errorResponse = { data: null, error: new Error("Not found") }
3165
+ * const failedIo = IO.fromResult(errorResponse) // IO<never, Error, Option<null>> -> fails
3166
+ * ```
3167
+ */
3168
+ fromResult: <D extends Type, E extends Type>(result: {
3169
+ data: D | null;
3170
+ error: E | null;
3171
+ }) => IO<never, E, Option<D>>;
3172
+ /**
3173
+ * Creates an IO from an async thunk with typed error handling.
3174
+ * Catches any thrown errors and maps them using the provided function.
3175
+ * Supports cancellation via AbortSignal.
3176
+ *
3177
+ * This is a simpler alternative to `tryPromise` that takes a direct
3178
+ * error mapper function instead of an options object.
3179
+ *
3180
+ * @param f - Async function to execute (receives optional AbortSignal)
3181
+ * @param onError - Function to map caught errors to typed error E
3182
+ * @param signal - Optional AbortSignal for cancellation support
3183
+ *
3184
+ * @example
3185
+ * ```typescript
3186
+ * const io = IO.tryAsync(
3187
+ * () => fetch('/api/users').then(r => r.json()),
3188
+ * (e) => new ApiError(e)
3189
+ * )
3190
+ *
3191
+ * // With cancellation:
3192
+ * const controller = new AbortController()
3193
+ * const io = IO.tryAsync(
3194
+ * (signal) => fetch('/api/users', { signal }).then(r => r.json()),
3195
+ * (e) => new ApiError(e),
3196
+ * controller.signal
3197
+ * )
3198
+ * controller.abort() // Cancels the request
3199
+ * ```
3200
+ */
3201
+ tryAsync: <A extends Type, E extends Type>(f: (signal?: AbortSignal) => Promise<A>, onError: (error: unknown) => E, signal?: AbortSignal) => IO<never, E, A>;
3202
+ /**
3203
+ * Creates an IO from an async function that returns { data, error }.
3204
+ * Handles both:
3205
+ * - Thrown errors (mapped via onThrow)
3206
+ * - Returned errors in the result object
3207
+ * Supports cancellation via AbortSignal.
3208
+ *
3209
+ * This is the most ergonomic way to wrap Supabase and similar API calls.
3210
+ *
3211
+ * @param f - Async function returning { data, error } object (receives optional AbortSignal)
3212
+ * @param onThrow - Function to map thrown errors to typed error E
3213
+ * @param config - Optional configuration for custom field names and cancellation
3214
+ *
3215
+ * @example
3216
+ * ```typescript
3217
+ * // Supabase query in one line:
3218
+ * const getUser = (id: string): IO<never, Error, Option<User>> =>
3219
+ * IO.asyncResult(
3220
+ * () => supabase.from('users').select('*').eq('id', id).single(),
3221
+ * toError
3222
+ * )
3223
+ *
3224
+ * // With custom field names:
3225
+ * const result = IO.asyncResult(
3226
+ * () => customApi.fetch(),
3227
+ * toError,
3228
+ * { dataKey: 'result', errorKey: 'err' }
3229
+ * )
3230
+ *
3231
+ * // With cancellation:
3232
+ * const controller = new AbortController()
3233
+ * const getUser = IO.asyncResult(
3234
+ * (signal) => supabase.from('users').abortSignal(signal).select('*').single(),
3235
+ * toError,
3236
+ * { signal: controller.signal }
3237
+ * )
3238
+ * controller.abort() // Cancels the request
3239
+ * ```
3240
+ */
3241
+ asyncResult: <D extends Type, E extends Type>(f: (signal?: AbortSignal) => Promise<Record<string, unknown>>, onThrow: (error: unknown) => E, config?: {
3242
+ dataKey?: string;
3243
+ errorKey?: string;
3244
+ signal?: AbortSignal;
3245
+ }) => IO<never, E, Option<D>>;
3246
+ /**
3247
+ * Creates an IO that requires a service identified by the tag.
3248
+ * The service must be provided before the effect can be run.
3249
+ *
3250
+ * @example
3251
+ * ```typescript
3252
+ * interface Logger {
3253
+ * log(message: string): void
3254
+ * }
3255
+ * const Logger = Tag<Logger>("Logger")
3256
+ *
3257
+ * const program = IO.service(Logger).flatMap(logger =>
3258
+ * IO.sync(() => logger.log("Hello!"))
3259
+ * )
3260
+ *
3261
+ * // Provide the service to run
3262
+ * program.provideService(Logger, consoleLogger).run()
3263
+ * ```
3264
+ */
3265
+ service: <S extends Type>(tag: Tag<S>) => IO<S, never, S>;
3266
+ /**
3267
+ * Accesses a service and applies a function to it.
3268
+ */
3269
+ serviceWith: <S extends Type, A extends Type>(tag: Tag<S>, f: (service: S) => A) => IO<S, never, A>;
3270
+ /**
3271
+ * Accesses a service and applies an effectful function to it.
3272
+ */
3273
+ serviceWithIO: <S extends Type, R$1 extends Type, E extends Type, A extends Type>(tag: Tag<S>, f: (service: S) => IO<R$1, E, A>) => IO<S | R$1, E, A>;
3274
+ /**
3275
+ * Accesses multiple services and applies a function to them.
3276
+ * Provides a convenient way to work with multiple dependencies.
3277
+ *
3278
+ * @example
3279
+ * ```typescript
3280
+ * const program = IO.withServices(
3281
+ * { logger: Logger, db: Database },
3282
+ * ({ logger, db }) => {
3283
+ * logger.log("Querying...")
3284
+ * return db.query("SELECT * FROM users")
3285
+ * }
3286
+ * )
3287
+ * ```
3288
+ */
3289
+ withServices: <Services extends Record<string, Tag<Type>>, A extends Type>(services: Services, f: (ctx: { [K in keyof Services]: TagService<Services[K]> }) => A | Promise<A>) => IO<TagService<Services[keyof Services]>, unknown, A>;
3290
+ /**
3291
+ * Runs all IOs in parallel and collects results.
3292
+ */
3293
+ all: <R$1 extends Type, E extends Type, A extends Type>(effects: readonly IO<R$1, E, A>[]) => IO<R$1, E, readonly A[]>;
3294
+ /**
3295
+ * Runs IOs in sequence, returning the first success or last failure.
3296
+ */
3297
+ firstSuccessOf: <R$1 extends Type, E extends Type, A extends Type>(effects: readonly IO<R$1, E, A>[]) => IO<R$1, E, A>;
3298
+ /**
3299
+ * Creates an IO that sleeps for the specified duration.
3300
+ */
3301
+ sleep: (ms: number) => IO<never, never, void>;
3302
+ /**
3303
+ * Creates an IO that never completes.
3304
+ */
3305
+ never: <A extends Type = never>() => IO<never, never, A>;
3306
+ /**
3307
+ * Creates a unit IO.
3308
+ */
3309
+ readonly unit: IO<never, never, void>;
3310
+ /**
3311
+ * Converts a nullable value to an IO.
3312
+ */
3313
+ fromNullable: <A extends Type>(value: A | null | undefined) => IO<never, void, A>;
3314
+ /**
3315
+ * Creates an IO that is immediately interrupted.
3316
+ */
3317
+ interrupt: () => IO<never, never, never>;
3318
+ /**
3319
+ * Ensures a resource is properly released after use.
3320
+ * The release function always runs, even if use fails.
3321
+ *
3322
+ * @example
3323
+ * ```typescript
3324
+ * const withFile = IO.bracket(
3325
+ * IO.sync(() => openFile("data.txt")), // acquire
3326
+ * file => IO.async(() => file.read()), // use
3327
+ * file => IO.sync(() => file.close()) // release
3328
+ * )
3329
+ * ```
3330
+ */
3331
+ bracket: <R$1 extends Type, E extends Type, A extends Type, B extends Type>(acquire: IO<R$1, E, A>, use: (a: A) => IO<R$1, E, B>, release: (a: A) => IO<R$1, never, void>) => IO<R$1, E, B>;
3332
+ /**
3333
+ * Alias for bracket with a more descriptive name.
3334
+ */
3335
+ acquireRelease: <R$1 extends Type, E extends Type, A extends Type, B extends Type>(acquire: IO<R$1, E, A>, use: (a: A) => IO<R$1, E, B>, release: (a: A) => IO<R$1, never, void>) => IO<R$1, E, B>;
3336
+ /**
3337
+ * Races multiple effects, returning the first to complete.
3338
+ * Note: Other effects are NOT cancelled (JS limitation).
3339
+ *
3340
+ * @example
3341
+ * ```typescript
3342
+ * const result = await IO.race([
3343
+ * IO.sleep(1000).map(() => "slow"),
3344
+ * IO.sleep(100).map(() => "fast")
3345
+ * ]).run() // "fast"
3346
+ * ```
3347
+ */
3348
+ race: <R$1 extends Type, E extends Type, A extends Type>(effects: readonly IO<R$1, E, A>[]) => IO<R$1, E, A>;
3349
+ /**
3350
+ * Returns the first effect to succeed, or fails if all fail.
3351
+ *
3352
+ * @example
3353
+ * ```typescript
3354
+ * const result = await IO.any([
3355
+ * IO.fail("error1"),
3356
+ * IO.succeed("success"),
3357
+ * IO.fail("error2")
3358
+ * ]).run() // "success"
3359
+ * ```
3360
+ */
3361
+ any: <R$1 extends Type, E extends Type, A extends Type>(effects: readonly IO<R$1, E, A>[]) => IO<R$1, E, A>;
3362
+ /**
3363
+ * Executes an effect for each element in the array, collecting results.
3364
+ *
3365
+ * @example
3366
+ * ```typescript
3367
+ * const results = await IO.forEach([1, 2, 3], n =>
3368
+ * IO.sync(() => n * 2)
3369
+ * ).run() // [2, 4, 6]
3370
+ * ```
3371
+ */
3372
+ forEach: <R$1 extends Type, E extends Type, A extends Type, B extends Type>(items: readonly A[], f: (a: A) => IO<R$1, E, B>) => IO<R$1, E, readonly B[]>;
3373
+ /**
3374
+ * Executes effects for each element in parallel (limited concurrency coming later).
3375
+ * Alias for forEach.
3376
+ */
3377
+ forEachPar: <R$1 extends Type, E extends Type, A extends Type, B extends Type>(items: readonly A[], f: (a: A) => IO<R$1, E, B>) => IO<R$1, E, readonly B[]>;
3378
+ /**
3379
+ * Creates a timeout effect that fails with TimeoutError.
3380
+ */
3381
+ timeout: <R$1 extends Type, E extends Type, A extends Type>(effect: IO<R$1, E, A>, ms: number) => IO<R$1, E | TimeoutError, A>;
3382
+ /**
3383
+ * Creates an IO from a generator function.
3384
+ * This enables do-notation style programming.
3385
+ *
3386
+ * @example
3387
+ * ```typescript
3388
+ * const program = IO.gen(function* () {
3389
+ * const a = yield* IO.succeed(1)
3390
+ * const b = yield* IO.succeed(2)
3391
+ * return a + b
3392
+ * })
3393
+ * ```
3394
+ */
3395
+ gen: <A extends Type>(f: () => Generator<IO<any, any, any>, A, any>) => IO<never, any, A>;
3396
+ /**
3397
+ * Starts a Do-builder context for binding values.
3398
+ * This enables do-notation style programming without generators.
3399
+ *
3400
+ * @example
3401
+ * ```typescript
3402
+ * const program = IO.Do
3403
+ * .bind("user", () => getUser("123"))
3404
+ * .bind("posts", ({ user }) => getPosts(user.id))
3405
+ * .let("count", ({ posts }) => posts.length)
3406
+ * .map(({ user, posts, count }) => ({ user, posts, count }))
3407
+ * ```
3408
+ */
3409
+ readonly Do: DoBuilder<never, never, Record<never, never>>;
3410
+ };
3411
+ /**
3412
+ * An IO with no requirements and no error
3413
+ */
3414
+ type UIO<A extends Type> = IO<never, never, A>;
3415
+ /**
3416
+ * An IO with no requirements
3417
+ */
3418
+ type Task<E extends Type, A extends Type> = IO<never, E, A>;
3419
+ /**
3420
+ * An IO with no error
3421
+ */
3422
+ type RIO<R$1 extends Type, A extends Type> = IO<R$1, never, A>;
3423
+ //#endregion
3424
+ //#region src/io/TestClock.d.ts
3425
+ /**
3426
+ * TestClock interface for controlling time in tests
3427
+ */
3428
+ interface TestClock {
3429
+ /**
3430
+ * Current virtual time in milliseconds
3431
+ */
3432
+ readonly currentTime: number;
3433
+ /**
3434
+ * Advances the clock by the specified duration.
3435
+ * All scheduled tasks with a time <= new current time will be executed.
3436
+ * @param ms - Milliseconds to advance
3437
+ */
3438
+ advance(ms: number): Promise<void>;
3439
+ /**
3440
+ * Sets the clock to a specific time.
3441
+ * @param ms - The absolute time to set
3442
+ */
3443
+ setTime(ms: number): Promise<void>;
3444
+ /**
3445
+ * Runs all pending tasks immediately.
3446
+ */
3447
+ runAll(): Promise<void>;
3448
+ /**
3449
+ * Gets the number of pending scheduled tasks.
3450
+ */
3451
+ readonly pendingCount: number;
3452
+ /**
3453
+ * Sleeps for the specified duration using virtual time.
3454
+ * @param ms - Milliseconds to sleep
3455
+ */
3456
+ sleep(ms: number): Promise<void>;
3457
+ }
3458
+ /**
3459
+ * Service tag for TestClock
3460
+ */
3461
+ declare const TestClockTag: Tag<TestClock>;
3462
+ /**
3463
+ * TestClock companion object with factory methods
3464
+ */
3465
+ declare const TestClock: {
3466
+ /**
3467
+ * Creates a new TestClock instance
3468
+ */
3469
+ make: () => TestClock;
3470
+ /**
3471
+ * Tag for dependency injection
3472
+ */
3473
+ tag: Tag<TestClock>;
3474
+ /**
3475
+ * Creates a test environment with a TestClock and runs the test function.
3476
+ *
3477
+ * @example
3478
+ * ```typescript
3479
+ * await TestClock.test(async (clock) => {
3480
+ * const result = await IO.sleep(100).map(() => "done")
3481
+ * .pipe(clock.runWithClock)
3482
+ * expect(result).toBe("done")
3483
+ * })
3484
+ * ```
3485
+ */
3486
+ test: <A>(f: (clock: TestClock) => Promise<A>) => Promise<A>;
3487
+ /**
3488
+ * Creates an IO that accesses the TestClock from the environment.
3489
+ */
3490
+ get: IO<TestClock, never, TestClock>;
3491
+ /**
3492
+ * Creates an IO that advances the TestClock.
3493
+ */
3494
+ advance: (ms: number) => IO<TestClock, never, void>;
3495
+ /**
3496
+ * Creates an IO that sets the TestClock time.
3497
+ */
3498
+ setTime: (ms: number) => IO<TestClock, never, void>;
3499
+ /**
3500
+ * Creates an IO that runs all pending tasks.
3501
+ */
3502
+ runAll: IO<TestClock, unknown, void>;
3503
+ /**
3504
+ * Creates a context with a TestClock for testing.
3505
+ */
3506
+ context: () => {
3507
+ clock: TestClock;
3508
+ context: ReturnType<typeof Context.make<TestClock>>;
3509
+ };
3510
+ };
3511
+ /**
3512
+ * TestContext provides a complete test environment with mocked services.
3513
+ */
3514
+ interface TestContext<R$1 extends Type> {
3515
+ /**
3516
+ * The context containing test services
3517
+ */
3518
+ readonly context: ReturnType<typeof Context.empty<R$1>>;
3519
+ /**
3520
+ * The TestClock for controlling time
3521
+ */
3522
+ readonly clock: TestClock;
3523
+ /**
3524
+ * Adds a service to the test context
3525
+ */
3526
+ withService<S extends Type>(tag: Tag<S>, service: S): TestContext<R$1 & S>;
3527
+ /**
3528
+ * Provides the test context to an IO effect and runs it
3529
+ */
3530
+ run<E extends Type, A extends Type>(effect: IO<R$1, E, A>): Promise<A>;
3531
+ }
3532
+ /**
3533
+ * Creates a TestContext for testing IO effects with mocked services.
3534
+ *
3535
+ * @example
3536
+ * ```typescript
3537
+ * const ctx = TestContext.make()
3538
+ * .withService(Logger, mockLogger)
3539
+ * .withService(Database, mockDb)
3540
+ *
3541
+ * const result = await ctx.run(myProgram)
3542
+ * ```
3543
+ */
3544
+ declare const TestContext: {
3545
+ /**
3546
+ * Creates a new empty TestContext
3547
+ */
3548
+ make: <R$1 extends Type = never>() => TestContext<R$1>;
3549
+ /**
3550
+ * Creates a TestContext with a TestClock already provided
3551
+ */
3552
+ withClock: () => TestContext<TestClock>;
2197
3553
  };
2198
3554
  //#endregion
2199
3555
  //#region src/lazy/Lazy.d.ts
@@ -2207,7 +3563,7 @@ declare const Identity: (<T$1>(value: T$1) => Identity<T$1>) & {
2207
3563
  * It provides memoization and safe evaluation with integration to Option, Either, and Try.
2208
3564
  * @typeParam T - The type of the value to be computed
2209
3565
  */
2210
- interface Lazy<T$1 extends Type> extends FunctypeBase<T$1, "Lazy">, Extractable<T$1>, Pipe<T$1> {
3566
+ interface Lazy<T extends Type> extends FunctypeBase<T, "Lazy">, Extractable<T>, Pipe<T> {
2211
3567
  /** Tag identifying this as a Lazy type */
2212
3568
  readonly _tag: "Lazy";
2213
3569
  /** Whether the computation has been evaluated */
@@ -2217,138 +3573,138 @@ interface Lazy<T$1 extends Type> extends FunctypeBase<T$1, "Lazy">, Extractable<
2217
3573
  * @param defaultValue - The value to return if computation fails
2218
3574
  * @returns The computed value or defaultValue
2219
3575
  */
2220
- orElse(defaultValue: T$1): T$1;
3576
+ orElse(defaultValue: T): T;
2221
3577
  /**
2222
3578
  * Returns the computed value or null if computation fails
2223
3579
  * @returns The computed value or null
2224
3580
  */
2225
- orNull(): T$1 | null;
3581
+ orNull(): T | null;
2226
3582
  /**
2227
3583
  * Returns the computed value or throws an error if computation fails
2228
3584
  * @param error - Optional custom error to throw. If not provided, throws the computation error or a default error
2229
3585
  * @returns The computed value
2230
3586
  * @throws The specified error, computation error, or a default error
2231
3587
  */
2232
- orThrow(error?: Error): T$1;
3588
+ orThrow(error?: Error): T;
2233
3589
  /**
2234
3590
  * Returns this Lazy if computation succeeds, otherwise returns the alternative Lazy
2235
3591
  * @param alternative - The alternative Lazy to use if computation fails
2236
3592
  * @returns This Lazy or the alternative
2237
3593
  */
2238
- or(alternative: Lazy<T$1>): Lazy<T$1>;
3594
+ or(alternative: Lazy<T>): Lazy<T>;
2239
3595
  /**
2240
3596
  * Maps the value inside the Lazy using the provided function
2241
3597
  * @param f - The mapping function
2242
3598
  * @returns A new Lazy containing the mapped value
2243
3599
  */
2244
- map<U extends Type>(f: (value: T$1) => U): Lazy<U>;
3600
+ map<U extends Type>(f: (value: T) => U): Lazy<U>;
2245
3601
  /**
2246
3602
  * Applies a wrapped function to a wrapped value (Applicative pattern)
2247
3603
  * @param ff - A Lazy containing a function from T to U
2248
3604
  * @returns A new Lazy containing the result
2249
3605
  */
2250
- ap<U extends Type>(ff: Lazy<(value: T$1) => U>): Lazy<U>;
3606
+ ap<U extends Type>(ff: Lazy<(value: T) => U>): Lazy<U>;
2251
3607
  /**
2252
3608
  * Maps the value inside the Lazy using an async function
2253
3609
  * @param f - The async mapping function
2254
3610
  * @returns A Promise of a new Lazy containing the mapped value
2255
3611
  */
2256
- mapAsync<U extends Type>(f: (value: T$1) => Promise<U>): Promise<Lazy<U>>;
3612
+ mapAsync<U extends Type>(f: (value: T) => Promise<U>): Promise<Lazy<U>>;
2257
3613
  /**
2258
3614
  * Maps the value using a function that returns a Lazy
2259
3615
  * @param f - The mapping function returning a Lazy
2260
3616
  * @returns A new Lazy containing the flattened result
2261
3617
  */
2262
- flatMap<U extends Type>(f: (value: T$1) => Lazy<U>): Lazy<U>;
3618
+ flatMap<U extends Type>(f: (value: T) => Lazy<U>): Lazy<U>;
2263
3619
  /**
2264
3620
  * Maps the value using an async function that returns a Lazy
2265
3621
  * @param f - The async mapping function returning a Lazy
2266
3622
  * @returns A Promise of a new Lazy containing the flattened result
2267
3623
  */
2268
- flatMapAsync<U extends Type>(f: (value: T$1) => Promise<Lazy<U>>): Promise<Lazy<U>>;
3624
+ flatMapAsync<U extends Type>(f: (value: T) => Promise<Lazy<U>>): Promise<Lazy<U>>;
2269
3625
  /**
2270
3626
  * Returns a Lazy that filters the value based on a predicate
2271
3627
  * @param predicate - The predicate function
2272
3628
  * @returns A Lazy containing an Option of the value
2273
3629
  */
2274
- filter(predicate: (value: T$1) => boolean): Lazy<Option<T$1>>;
3630
+ filter(predicate: (value: T) => boolean): Lazy<Option<T>>;
2275
3631
  /**
2276
3632
  * Recovers from a failed computation by providing an alternative value
2277
3633
  * @param f - Function that takes the error and returns a recovery value
2278
3634
  * @returns A new Lazy that will use the recovery function if computation fails
2279
3635
  */
2280
- recover(f: (error: unknown) => T$1): Lazy<T$1>;
3636
+ recover(f: (error: unknown) => T): Lazy<T>;
2281
3637
  /**
2282
3638
  * Recovers from a failed computation by providing an alternative Lazy
2283
3639
  * @param f - Function that takes the error and returns a recovery Lazy
2284
3640
  * @returns A new Lazy that will use the recovery Lazy if computation fails
2285
3641
  */
2286
- recoverWith(f: (error: unknown) => Lazy<T$1>): Lazy<T$1>;
3642
+ recoverWith(f: (error: unknown) => Lazy<T>): Lazy<T>;
2287
3643
  /**
2288
3644
  * Evaluates the computation and returns it as an Option
2289
3645
  * @returns Some containing the value if successful, None if computation fails
2290
3646
  */
2291
- toOption(): Option<T$1>;
3647
+ toOption(): Option<T>;
2292
3648
  /**
2293
3649
  * Evaluates the computation and returns it as an Either
2294
3650
  * @returns Right containing the value if successful, Left containing the error if computation fails
2295
3651
  */
2296
- toEither(): Either<unknown, T$1>;
3652
+ toEither(): Either<unknown, T>;
2297
3653
  /**
2298
3654
  * Evaluates the computation and returns it as an Either with a mapped error
2299
3655
  * @param mapError - Function to map the error
2300
3656
  * @returns Right containing the value if successful, Left containing the mapped error if computation fails
2301
3657
  */
2302
- toEitherWith<E>(mapError: (error: unknown) => E): Either<E, T$1>;
3658
+ toEitherWith<E>(mapError: (error: unknown) => E): Either<E, T>;
2303
3659
  /**
2304
3660
  * Evaluates the computation and returns it as a Try
2305
3661
  * @returns Try containing the result of the computation
2306
3662
  */
2307
- toTry(): Try<T$1>;
3663
+ toTry(): Try<T>;
2308
3664
  /**
2309
3665
  * Applies an effect function to the value if computation succeeds
2310
3666
  * @param f - The effect function
2311
3667
  * @returns This Lazy for chaining
2312
3668
  */
2313
- tap(f: (value: T$1) => void): Lazy<T$1>;
3669
+ tap(f: (value: T) => void): Lazy<T>;
2314
3670
  /**
2315
3671
  * Applies an effect function to the error if computation fails
2316
3672
  * @param f - The effect function for errors
2317
3673
  * @returns This Lazy for chaining
2318
3674
  */
2319
- tapError(f: (error: unknown) => void): Lazy<T$1>;
3675
+ tapError(f: (error: unknown) => void): Lazy<T>;
2320
3676
  /**
2321
3677
  * Pattern matching on the Lazy value
2322
3678
  * @param f - Function to apply to the computed value
2323
3679
  * @returns The result of applying f to the computed value
2324
3680
  */
2325
- fold<U>(f: (value: T$1) => U): U;
3681
+ fold<U>(f: (value: T) => U): U;
2326
3682
  /**
2327
3683
  * Pattern matching with success and failure handlers
2328
3684
  * @param onFailure - Function to handle computation failure
2329
3685
  * @param onSuccess - Function to handle successful computation
2330
3686
  * @returns The result of the appropriate handler
2331
3687
  */
2332
- foldWith<U>(onFailure: (error: unknown) => U, onSuccess: (value: T$1) => U): U;
3688
+ foldWith<U>(onFailure: (error: unknown) => U, onSuccess: (value: T) => U): U;
2333
3689
  /**
2334
3690
  * Left fold operation
2335
3691
  * @param z - Initial value
2336
3692
  * @returns Function that takes an operator and applies it
2337
3693
  */
2338
- foldLeft: <B>(z: B) => (op: (b: B, a: T$1) => B) => B;
3694
+ foldLeft: <B>(z: B) => (op: (b: B, a: T) => B) => B;
2339
3695
  /**
2340
3696
  * Right fold operation
2341
3697
  * @param z - Initial value
2342
3698
  * @returns Function that takes an operator and applies it
2343
3699
  */
2344
- foldRight: <B>(z: B) => (op: (a: T$1, b: B) => B) => B;
3700
+ foldRight: <B>(z: B) => (op: (a: T, b: B) => B) => B;
2345
3701
  /**
2346
3702
  * Pattern matching for the Lazy type
2347
3703
  * @param patterns - Object with handler for Lazy pattern
2348
3704
  * @returns The result of the matched handler
2349
3705
  */
2350
3706
  match<R$1>(patterns: {
2351
- Lazy: (value: T$1) => R$1;
3707
+ Lazy: (value: T) => R$1;
2352
3708
  }): R$1;
2353
3709
  /**
2354
3710
  * Creates a string representation of the Lazy
@@ -2362,7 +3718,7 @@ interface Lazy<T$1 extends Type> extends FunctypeBase<T$1, "Lazy">, Extractable<
2362
3718
  toValue(): {
2363
3719
  _tag: "Lazy";
2364
3720
  evaluated: boolean;
2365
- value?: T$1;
3721
+ value?: T;
2366
3722
  };
2367
3723
  }
2368
3724
  /**
@@ -2404,50 +3760,50 @@ interface Lazy<T$1 extends Type> extends FunctypeBase<T$1, "Lazy">, Extractable<
2404
3760
  * .map(user => user.name)
2405
3761
  * .orThrow() // "Alice"
2406
3762
  */
2407
- declare const Lazy: (<T$1 extends Type>(thunk: () => T$1) => Lazy<T$1>) & {
3763
+ declare const Lazy: (<T extends Type>(thunk: () => T) => Lazy<T>) & {
2408
3764
  /**
2409
3765
  * Creates a Lazy from a thunk (deferred computation)
2410
3766
  * @param thunk - Function that computes the value
2411
3767
  * @returns A new Lazy instance
2412
3768
  */
2413
- of: <T$1 extends Type>(thunk: () => T$1) => Lazy<T$1>;
3769
+ of: <T extends Type>(thunk: () => T) => Lazy<T>;
2414
3770
  /**
2415
3771
  * Creates a Lazy from an immediate value
2416
3772
  * @param value - The value to wrap
2417
3773
  * @returns A new Lazy instance that returns the value
2418
3774
  */
2419
- fromValue: <T$1 extends Type>(value: T$1) => Lazy<T$1>;
3775
+ fromValue: <T extends Type>(value: T) => Lazy<T>;
2420
3776
  /**
2421
3777
  * Creates a Lazy from an Option
2422
3778
  * @param option - The Option to convert
2423
3779
  * @param defaultThunk - Thunk to compute default value if Option is None
2424
3780
  * @returns A new Lazy instance
2425
3781
  */
2426
- fromOption: <T$1 extends Type>(option: Option<T$1>, defaultThunk: () => T$1) => Lazy<T$1>;
3782
+ fromOption: <T extends Type>(option: Option<T>, defaultThunk: () => T) => Lazy<T>;
2427
3783
  /**
2428
3784
  * Creates a Lazy from a Try
2429
3785
  * @param tryValue - The Try to convert
2430
3786
  * @returns A new Lazy instance
2431
3787
  */
2432
- fromTry: <T$1 extends Type>(tryValue: Try<T$1>) => Lazy<T$1>;
3788
+ fromTry: <T extends Type>(tryValue: Try<T>) => Lazy<T>;
2433
3789
  /**
2434
3790
  * Creates a Lazy from an Either
2435
3791
  * @param either - The Either to convert
2436
3792
  * @returns A new Lazy instance
2437
3793
  */
2438
- fromEither: <E, T$1 extends Type>(either: Either<E, T$1>) => Lazy<T$1>;
3794
+ fromEither: <E, T extends Type>(either: Either<E, T>) => Lazy<T>;
2439
3795
  /**
2440
3796
  * Creates a Lazy that will throw an error since promises need to be awaited first
2441
3797
  * @param promise - The Promise to convert
2442
3798
  * @returns A new Lazy instance that throws an error
2443
3799
  */
2444
- fromPromise: <T$1 extends Type>(_promise: Promise<T$1>) => Lazy<T$1>;
3800
+ fromPromise: <T extends Type>(_promise: Promise<T>) => Lazy<T>;
2445
3801
  /**
2446
3802
  * Creates a failed Lazy that will throw when evaluated
2447
3803
  * @param error - The error to throw
2448
3804
  * @returns A new Lazy instance that throws the error
2449
3805
  */
2450
- fail: <T$1 extends Type>(error: unknown) => Lazy<T$1>;
3806
+ fail: <T extends Type>(error: unknown) => Lazy<T>;
2451
3807
  };
2452
3808
  //#endregion
2453
3809
  //#region src/traversable/Traversable.d.ts
@@ -2658,42 +4014,42 @@ declare const createCustomSerializer: (data: Record<string, unknown>) => Seriali
2658
4014
  * @param reconstructor - Function to reconstruct the type from parsed data
2659
4015
  * @returns Reconstructed instance
2660
4016
  */
2661
- declare const fromJSON: <T$1>(json: string, reconstructor: (parsed: {
4017
+ declare const fromJSON: <T>(json: string, reconstructor: (parsed: {
2662
4018
  _tag: string;
2663
4019
  [key: string]: unknown;
2664
- }) => T$1) => T$1;
4020
+ }) => T) => T;
2665
4021
  /**
2666
4022
  * Generic deserializer from YAML (simple format)
2667
4023
  * @param yaml - The YAML string to parse
2668
4024
  * @param reconstructor - Function to reconstruct the type from parsed data
2669
4025
  * @returns Reconstructed instance
2670
4026
  */
2671
- declare const fromYAML: <T$1>(yaml: string, reconstructor: (parsed: {
4027
+ declare const fromYAML: <T>(yaml: string, reconstructor: (parsed: {
2672
4028
  _tag: string;
2673
4029
  [key: string]: unknown;
2674
- }) => T$1) => T$1;
4030
+ }) => T) => T;
2675
4031
  /**
2676
4032
  * Generic deserializer from binary (base64-encoded JSON)
2677
4033
  * @param binary - The base64-encoded binary string
2678
4034
  * @param reconstructor - Function to reconstruct the type from parsed data
2679
4035
  * @returns Reconstructed instance
2680
4036
  */
2681
- declare const fromBinary: <T$1>(binary: string, reconstructor: (parsed: {
4037
+ declare const fromBinary: <T>(binary: string, reconstructor: (parsed: {
2682
4038
  _tag: string;
2683
4039
  [key: string]: unknown;
2684
- }) => T$1) => T$1;
4040
+ }) => T) => T;
2685
4041
  /**
2686
4042
  * Creates companion serialization methods for a type
2687
4043
  * @param reconstructor - Function to reconstruct the type from parsed data
2688
4044
  * @returns Companion methods object with fromJSON, fromYAML, and fromBinary
2689
4045
  */
2690
- declare const createSerializationCompanion: <T$1>(reconstructor: (parsed: {
4046
+ declare const createSerializationCompanion: <T>(reconstructor: (parsed: {
2691
4047
  _tag: string;
2692
4048
  [key: string]: unknown;
2693
- }) => T$1) => {
2694
- fromJSON: (json: string) => T$1;
2695
- fromYAML: (yaml: string) => T$1;
2696
- fromBinary: (binary: string) => T$1;
4049
+ }) => T) => {
4050
+ fromJSON: (json: string) => T;
4051
+ fromYAML: (yaml: string) => T;
4052
+ fromBinary: (binary: string) => T;
2697
4053
  };
2698
4054
  //#endregion
2699
4055
  //#region src/set/Set.d.ts
@@ -2737,9 +4093,9 @@ declare const Set: (<A>(iterable?: Iterable<A>) => Set<A>) & {
2737
4093
  /**
2738
4094
  * Parameters for creating a Valuable instance
2739
4095
  */
2740
- type ValuableParams<Tag extends string, T$1, V> = {
2741
- _tag: Tag;
2742
- impl: T$1;
4096
+ type ValuableParams<Tag$1 extends string, T, V> = {
4097
+ _tag: Tag$1;
4098
+ impl: T;
2743
4099
  value: V;
2744
4100
  };
2745
4101
  /**
@@ -2748,16 +4104,16 @@ type ValuableParams<Tag extends string, T$1, V> = {
2748
4104
  * @module Valuable
2749
4105
  * @category Utilities
2750
4106
  */
2751
- declare function Valuable<Tag extends string, V, T$1 = object>(params: ValuableParams<Tag, T$1, V>): T$1 & {
4107
+ declare function Valuable<Tag$1 extends string, V, T = object>(params: ValuableParams<Tag$1, T, V>): T & {
2752
4108
  toValue: () => {
2753
- _tag: Tag;
4109
+ _tag: Tag$1;
2754
4110
  value: V;
2755
4111
  };
2756
- _tag: Tag;
4112
+ _tag: Tag$1;
2757
4113
  };
2758
- type Valuable<Tag extends string, V, T$1 = object> = Typeable<Tag, T$1> & {
4114
+ type Valuable<Tag$1 extends string, V, T = object> = Typeable<Tag$1, T> & {
2759
4115
  toValue: () => {
2760
- _tag: Tag;
4116
+ _tag: Tag$1;
2761
4117
  value: V;
2762
4118
  };
2763
4119
  };
@@ -2876,24 +4232,24 @@ declare const Stack: (<A extends Type>(values?: A[]) => Stack<A>) & {
2876
4232
  * It's used to handle potentially null or undefined values in a type-safe way.
2877
4233
  * @typeParam T - The type of the value contained in the Option
2878
4234
  */
2879
- interface Option<T$1 extends Type> extends Functype<T$1, "Some" | "None">, Promisable<T$1>, Doable<T$1>, Reshapeable<T$1> {
4235
+ interface Option<T extends Type> extends Functype<T, "Some" | "None">, Promisable<T>, Doable<T>, Reshapeable<T> {
2880
4236
  /** The contained value (undefined for None) */
2881
- readonly value: T$1 | undefined;
4237
+ readonly value: T | undefined;
2882
4238
  /** Whether this Option contains no value */
2883
4239
  isEmpty: boolean;
2884
4240
  /**
2885
4241
  * Returns true if this Option is a Some (contains a value)
2886
4242
  * @returns true if this Option contains a value, false otherwise
2887
4243
  */
2888
- isSome(): this is Option<T$1> & {
2889
- value: T$1;
4244
+ isSome(): this is Option<T> & {
4245
+ value: T;
2890
4246
  isEmpty: false;
2891
4247
  };
2892
4248
  /**
2893
4249
  * Returns true if this Option is a None (contains no value)
2894
4250
  * @returns true if this Option is empty, false otherwise
2895
4251
  */
2896
- isNone(): this is Option<T$1> & {
4252
+ isNone(): this is Option<T> & {
2897
4253
  value: undefined;
2898
4254
  isEmpty: true;
2899
4255
  };
@@ -2902,102 +4258,102 @@ interface Option<T$1 extends Type> extends Functype<T$1, "Some" | "None">, Promi
2902
4258
  * @param defaultValue - The value to return if this Option is None
2903
4259
  * @returns The contained value or defaultValue
2904
4260
  */
2905
- orElse(defaultValue: T$1): T$1;
4261
+ orElse(defaultValue: T): T;
2906
4262
  /**
2907
4263
  * Returns the contained value or throws an error if None
2908
4264
  * @param error - Optional custom error to throw. If not provided, throws a default error
2909
4265
  * @returns The contained value
2910
4266
  * @throws The specified error or a default error if the Option is None
2911
4267
  */
2912
- orThrow(error?: Error): T$1;
4268
+ orThrow(error?: Error): T;
2913
4269
  /**
2914
4270
  * Returns this Option if it contains a value, otherwise returns the alternative container
2915
4271
  * @param alternative - The alternative Option to return if this is None
2916
4272
  * @returns This Option or the alternative
2917
4273
  */
2918
- or(alternative: Option<T$1>): Option<T$1>;
4274
+ or(alternative: Option<T>): Option<T>;
2919
4275
  /**
2920
4276
  * Returns the contained value or null if None
2921
4277
  * @returns The contained value or null
2922
4278
  */
2923
- orNull(): T$1 | null;
4279
+ orNull(): T | null;
2924
4280
  /**
2925
4281
  * Returns the contained value or undefined if None
2926
4282
  * @returns The contained value or undefined
2927
4283
  */
2928
- orUndefined(): T$1 | undefined;
4284
+ orUndefined(): T | undefined;
2929
4285
  /**
2930
4286
  * Maps the value inside the Option using the provided function
2931
4287
  * @param f - The mapping function
2932
4288
  * @returns A new Option containing the mapped value, or None if this Option is None
2933
4289
  */
2934
- map<U extends Type>(f: (value: T$1) => U): Option<U>;
4290
+ map<U extends Type>(f: (value: T) => U): Option<U>;
2935
4291
  /**
2936
4292
  * Applies a wrapped function to a wrapped value (Applicative pattern)
2937
4293
  * @param ff - An Option containing a function from T to U
2938
4294
  * @returns A new Option containing the result of applying the function
2939
4295
  */
2940
- ap<U extends Type>(ff: Option<(value: T$1) => U>): Option<U>;
4296
+ ap<U extends Type>(ff: Option<(value: T) => U>): Option<U>;
2941
4297
  /**
2942
4298
  * Returns this Option if it contains a value that satisfies the predicate, otherwise returns None
2943
4299
  * @param predicate - The predicate function to test the value
2944
4300
  * @returns This Option or None
2945
4301
  */
2946
- filter(predicate: (value: T$1) => boolean): Option<T$1>;
4302
+ filter(predicate: (value: T) => boolean): Option<T>;
2947
4303
  /**
2948
4304
  * Maps the value using a function that returns an Option
2949
4305
  * @param f - The mapping function returning an Option
2950
4306
  * @returns The result of applying f to the contained value, or None if this Option is None
2951
4307
  */
2952
- flatMap<U extends Type>(f: (value: T$1) => Option<U>): Option<U>;
4308
+ flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
2953
4309
  /**
2954
4310
  * Maps the value using an async function that returns an Option
2955
4311
  * @param f - The async mapping function returning an Option
2956
4312
  * @returns Promise of the result of applying f to the contained value, or None if this Option is None
2957
4313
  */
2958
- flatMapAsync<U extends Type>(f: (value: T$1) => Promise<Option<U>>): Promise<Option<U>>;
4314
+ flatMapAsync<U extends Type>(f: (value: T) => Promise<Option<U>>): Promise<Option<U>>;
2959
4315
  /**
2960
4316
  * Applies a binary operator to a start value and the contained value
2961
4317
  * @param f - The binary operator
2962
4318
  * @returns The result of the reduction
2963
4319
  */
2964
- reduce<U>(f: (acc: U, value: T$1) => U): U;
4320
+ reduce<U>(f: (acc: U, value: T) => U): U;
2965
4321
  /**
2966
4322
  * Applies a binary operator to the contained value and a start value
2967
4323
  * @param f - The binary operator
2968
4324
  * @returns The result of the reduction
2969
4325
  */
2970
- reduceRight<U>(f: (acc: U, value: T$1) => U): U;
4326
+ reduceRight<U>(f: (acc: U, value: T) => U): U;
2971
4327
  /**
2972
4328
  * Pattern matches over the Option, applying onNone if None and onSome if Some
2973
4329
  * @param onNone - Function to apply if the Option is None
2974
4330
  * @param onSome - Function to apply if the Option has a value
2975
4331
  * @returns The result of applying the appropriate function
2976
4332
  */
2977
- fold<U>(onNone: () => U, onSome: (value: T$1) => U): U;
4333
+ fold<U>(onNone: () => U, onSome: (value: T) => U): U;
2978
4334
  /**
2979
4335
  * Left-associative fold using the provided zero value and operation
2980
4336
  * @param z - Zero/identity value
2981
4337
  * @returns A function that takes an operation to apply
2982
4338
  */
2983
- foldLeft<B>(z: B): (op: (b: B, a: T$1) => B) => B;
4339
+ foldLeft<B>(z: B): (op: (b: B, a: T) => B) => B;
2984
4340
  /**
2985
4341
  * Right-associative fold using the provided zero value and operation
2986
4342
  * @param z - Zero/identity value
2987
4343
  * @returns A function that takes an operation to apply
2988
4344
  */
2989
- foldRight<B>(z: B): (op: (a: T$1, b: B) => B) => B;
4345
+ foldRight<B>(z: B): (op: (a: T, b: B) => B) => B;
2990
4346
  /**
2991
4347
  * Converts this Option to a List
2992
4348
  * @returns A List containing the value if Some, or empty List if None
2993
4349
  */
2994
- toList(): List<T$1>;
4350
+ toList(): List<T>;
2995
4351
  /**
2996
4352
  * Checks if this Option contains the specified value
2997
4353
  * @param value - The value to check for
2998
4354
  * @returns true if this Option contains the value, false otherwise
2999
4355
  */
3000
- contains(value: T$1): boolean;
4356
+ contains(value: T): boolean;
3001
4357
  /** The number of elements in this Option (0 or 1) */
3002
4358
  size: number;
3003
4359
  /**
@@ -3005,7 +4361,7 @@ interface Option<T$1 extends Type> extends Functype<T$1, "Some" | "None">, Promi
3005
4361
  * @param left - The value to use for Left if this Option is None
3006
4362
  * @returns Either.Right with the contained value if Some, or Either.Left with left if None
3007
4363
  */
3008
- toEither<E>(left: E): Either<E, T$1>;
4364
+ toEither<E>(left: E): Either<E, T>;
3009
4365
  /**
3010
4366
  * Returns a string representation of this Option
3011
4367
  * @returns A string representation
@@ -3017,7 +4373,7 @@ interface Option<T$1 extends Type> extends Functype<T$1, "Some" | "None">, Promi
3017
4373
  */
3018
4374
  toValue(): {
3019
4375
  _tag: "Some" | "None";
3020
- value: T$1;
4376
+ value: T;
3021
4377
  };
3022
4378
  /**
3023
4379
  * Pattern matches over the Option, applying a handler function based on the variant
@@ -3025,7 +4381,7 @@ interface Option<T$1 extends Type> extends Functype<T$1, "Some" | "None">, Promi
3025
4381
  * @returns The result of applying the matching handler function
3026
4382
  */
3027
4383
  match<R$1>(patterns: {
3028
- Some: (value: T$1) => R$1;
4384
+ Some: (value: T) => R$1;
3029
4385
  None: () => R$1;
3030
4386
  }): R$1;
3031
4387
  }
@@ -3035,13 +4391,13 @@ interface Option<T$1 extends Type> extends Functype<T$1, "Some" | "None">, Promi
3035
4391
  * @returns A new Some instance containing the value
3036
4392
  * @typeParam T - The type of the value
3037
4393
  */
3038
- declare const Some: <T$1 extends Type>(value: T$1) => Option<T$1>;
4394
+ declare const Some: <T extends Type>(value: T) => Option<T>;
3039
4395
  /**
3040
4396
  * Creates a None variant of Option representing absence of a value.
3041
4397
  * @returns A new None instance
3042
4398
  * @typeParam T - The type that would be contained if this was a Some
3043
4399
  */
3044
- declare const None: <T$1 extends Type>() => Option<T$1>;
4400
+ declare const None: <T extends Type>() => Option<T>;
3045
4401
  /**
3046
4402
  * Safely wraps a value that might be null or undefined in an Option.
3047
4403
  * Creates Some if the value is defined, None otherwise.
@@ -3049,28 +4405,28 @@ declare const None: <T$1 extends Type>() => Option<T$1>;
3049
4405
  * @returns Some(value) if value is defined, None otherwise
3050
4406
  * @typeParam T - The type of the value
3051
4407
  */
3052
- declare const OptionConstructor: <T$1 extends Type>(value: T$1 | null | undefined) => Option<T$1>;
3053
- declare const Option: (<T$1 extends Type>(value: T$1 | null | undefined) => Option<T$1>) & {
4408
+ declare const OptionConstructor: <T extends Type>(value: T | null | undefined) => Option<T>;
4409
+ declare const Option: (<T extends Type>(value: T | null | undefined) => Option<T>) & {
3054
4410
  /**
3055
4411
  * Creates an Option from any value. Alias for Option function.
3056
4412
  * @param value - The value to wrap
3057
4413
  * @returns Some(value) if value is defined, None otherwise
3058
4414
  * @typeParam T - The type of the value
3059
4415
  */
3060
- from: <T$1>(value: T$1) => Option<T$1>;
4416
+ from: <T>(value: T) => Option<T>;
3061
4417
  /**
3062
4418
  * Returns a None instance. Alias for None function.
3063
4419
  * @returns A None instance
3064
4420
  * @typeParam T - The type that would be contained if this was a Some
3065
4421
  */
3066
- none: <T$1>() => Option<T$1>;
4422
+ none: <T>() => Option<T>;
3067
4423
  /**
3068
4424
  * Type guard to check if an Option is Some
3069
4425
  * @param option - The Option to check
3070
4426
  * @returns True if Option is Some
3071
4427
  */
3072
- isSome: <T$1>(option: Option<T$1>) => option is Option<T$1> & {
3073
- value: T$1;
4428
+ isSome: <T>(option: Option<T>) => option is Option<T> & {
4429
+ value: T;
3074
4430
  isEmpty: false;
3075
4431
  };
3076
4432
  /**
@@ -3078,7 +4434,7 @@ declare const Option: (<T$1 extends Type>(value: T$1 | null | undefined) => Opti
3078
4434
  * @param option - The Option to check
3079
4435
  * @returns True if Option is None
3080
4436
  */
3081
- isNone: <T$1>(option: Option<T$1>) => option is Option<T$1> & {
4437
+ isNone: <T>(option: Option<T>) => option is Option<T> & {
3082
4438
  value: undefined;
3083
4439
  isEmpty: true;
3084
4440
  };
@@ -3087,19 +4443,19 @@ declare const Option: (<T$1 extends Type>(value: T$1 | null | undefined) => Opti
3087
4443
  * @param json - The JSON string
3088
4444
  * @returns Option instance
3089
4445
  */
3090
- fromJSON: <T$1>(json: string) => Option<T$1>;
4446
+ fromJSON: <T>(json: string) => Option<T>;
3091
4447
  /**
3092
4448
  * Creates an Option from YAML string
3093
4449
  * @param yaml - The YAML string
3094
4450
  * @returns Option instance
3095
4451
  */
3096
- fromYAML: <T$1>(yaml: string) => Option<T$1>;
4452
+ fromYAML: <T>(yaml: string) => Option<T>;
3097
4453
  /**
3098
4454
  * Creates an Option from binary string
3099
4455
  * @param binary - The binary string
3100
4456
  * @returns Option instance
3101
4457
  */
3102
- fromBinary: <T$1>(binary: string) => Option<T$1>;
4458
+ fromBinary: <T>(binary: string) => Option<T>;
3103
4459
  };
3104
4460
  //#endregion
3105
4461
  //#region src/list/List.d.ts
@@ -3114,7 +4470,7 @@ interface List<A> extends FunctypeCollection<A, "List">, Doable<A>, Reshapeable<
3114
4470
  filter(predicate: (a: A) => unknown): List<A>;
3115
4471
  filterNot: (p: (a: A) => boolean) => List<A>;
3116
4472
  /** @internal */
3117
- filterType: <T$1 extends Typeable<string, unknown>>(tag: string) => List<T$1 & A>;
4473
+ filterType: <T extends Typeable<string, unknown>>(tag: string) => List<T & A>;
3118
4474
  remove: (value: A) => List<A>;
3119
4475
  removeAt: (index: number) => List<A>;
3120
4476
  add: (item: A) => List<A>;
@@ -3180,8 +4536,8 @@ interface Collection<A> {
3180
4536
  * }
3181
4537
  * ```
3182
4538
  */
3183
- interface FunctypeBase<A, Tag extends string = string> extends AsyncMonad<A>, Traversable<A>, Serializable<A>, Foldable<A>, Typeable<Tag>, ContainerOps<A> {
3184
- readonly _tag: Tag;
4539
+ interface FunctypeBase<A, Tag$1 extends string = string> extends AsyncMonad<A>, Traversable<A>, Serializable<A>, Foldable<A>, Typeable<Tag$1>, ContainerOps<A> {
4540
+ readonly _tag: Tag$1;
3185
4541
  }
3186
4542
  /**
3187
4543
  * Interface for single-value containers like Option, Either, Try.
@@ -3190,9 +4546,9 @@ interface FunctypeBase<A, Tag extends string = string> extends AsyncMonad<A>, Tr
3190
4546
  * @typeParam A - The type of value contained
3191
4547
  * @typeParam Tag - The type tag for pattern matching
3192
4548
  */
3193
- interface Functype<A, Tag extends string = string> extends FunctypeBase<A, Tag>, Extractable<A>, Pipe<A>, Matchable<A, Tag> {
4549
+ interface Functype<A, Tag$1 extends string = string> extends FunctypeBase<A, Tag$1>, Extractable<A>, Pipe<A>, Matchable<A, Tag$1> {
3194
4550
  toValue(): {
3195
- _tag: Tag;
4551
+ _tag: Tag$1;
3196
4552
  value: A;
3197
4553
  };
3198
4554
  }
@@ -3203,13 +4559,13 @@ interface Functype<A, Tag extends string = string> extends FunctypeBase<A, Tag>,
3203
4559
  * @typeParam A - The element type of the collection
3204
4560
  * @typeParam Tag - The type tag for pattern matching
3205
4561
  */
3206
- interface FunctypeCollection<A, Tag extends string = string> extends Omit<FunctypeBase<A, Tag>, "flatMapAsync" | "flatMap">, Iterable<A>, Pipe<A[]>, Collection<A>, CollectionOps<A, FunctypeCollection<A, Tag>> {
4562
+ interface FunctypeCollection<A, Tag$1 extends string = string> extends Omit<FunctypeBase<A, Tag$1>, "flatMapAsync" | "flatMap">, Iterable<A>, Pipe<A[]>, Collection<A>, CollectionOps<A, FunctypeCollection<A, Tag$1>> {
3207
4563
  toValue(): {
3208
- _tag: Tag;
4564
+ _tag: Tag$1;
3209
4565
  value: A[];
3210
4566
  };
3211
- flatMap<B extends Type>(f: (value: A) => Iterable<B>): FunctypeCollection<B, Tag>;
3212
- flatMapAsync<B extends Type>(f: (value: A) => PromiseLike<Iterable<B>>): PromiseLike<FunctypeCollection<B, Tag>>;
4567
+ flatMap<B extends Type>(f: (value: A) => Iterable<B>): FunctypeCollection<B, Tag$1>;
4568
+ flatMapAsync<B extends Type>(f: (value: A) => PromiseLike<Iterable<B>>): PromiseLike<FunctypeCollection<B, Tag$1>>;
3213
4569
  }
3214
4570
  //#endregion
3215
4571
  //#region src/either/Either.d.ts
@@ -3251,7 +4607,7 @@ interface Either<L extends Type, R$1 extends Type> extends FunctypeBase<R$1, "Le
3251
4607
  tapLeft: (f: (value: L) => void) => Either<L, R$1>;
3252
4608
  mapLeft: <L2 extends Type>(f: (value: L) => L2) => Either<L2, R$1>;
3253
4609
  bimap: <L2 extends Type, R2 extends Type>(fl: (value: L) => L2, fr: (value: R$1) => R2) => Either<L2, R2>;
3254
- fold: <T$1 extends Type>(onLeft: (value: L) => T$1, onRight: (value: R$1) => T$1) => T$1;
4610
+ fold: <T extends Type>(onLeft: (value: L) => T, onRight: (value: R$1) => T) => T;
3255
4611
  swap: () => Either<R$1, L>;
3256
4612
  /**
3257
4613
  * Pipes the value through the provided function based on whether this is a Left or Right
@@ -3271,10 +4627,10 @@ interface Either<L extends Type, R$1 extends Type> extends FunctypeBase<R$1, "Le
3271
4627
  * @param patterns - Object with handler functions for Left and Right variants
3272
4628
  * @returns The result of applying the matching handler function
3273
4629
  */
3274
- match<T$1>(patterns: {
3275
- Left: (value: L) => T$1;
3276
- Right: (value: R$1) => T$1;
3277
- }): T$1;
4630
+ match<T>(patterns: {
4631
+ Left: (value: L) => T;
4632
+ Right: (value: R$1) => T;
4633
+ }): T;
3278
4634
  /**
3279
4635
  * Returns the value and tag for inspection
3280
4636
  */
@@ -3467,12 +4823,12 @@ type TryLike = {
3467
4823
  * @param gen - Generator function that yields monads and returns a result
3468
4824
  * @returns The same monad type as the first yield
3469
4825
  */
3470
- declare function Do<T$1>(gen: () => Generator<OptionLike, T$1, unknown>): Option<T$1>;
4826
+ declare function Do<T>(gen: () => Generator<OptionLike, T, unknown>): Option<T>;
3471
4827
  declare function Do<L, R$1>(gen: () => Generator<EitherLike, R$1, unknown>): Either<L, R$1>;
3472
- declare function Do<T$1>(gen: () => Generator<ListLike, T$1, unknown>): List<T$1>;
3473
- declare function Do<T$1>(gen: () => Generator<TryLike, T$1, unknown>): Try<T$1>;
3474
- declare function Do<T$1>(gen: () => Generator<OptionLike | EitherLike | ListLike | TryLike, T$1, unknown>): Reshapeable<T$1>;
3475
- declare function Do<T$1>(gen: () => Generator<unknown, T$1, unknown>): unknown;
4828
+ declare function Do<T>(gen: () => Generator<ListLike, T, unknown>): List<T>;
4829
+ declare function Do<T>(gen: () => Generator<TryLike, T, unknown>): Try<T>;
4830
+ declare function Do<T>(gen: () => Generator<OptionLike | EitherLike | ListLike | TryLike, T, unknown>): Reshapeable<T>;
4831
+ declare function Do<T>(gen: () => Generator<unknown, T, unknown>): unknown;
3476
4832
  /**
3477
4833
  * Executes an async generator-based monadic comprehension
3478
4834
  * Returns the same monad type as the first yielded monad
@@ -3490,18 +4846,18 @@ declare function Do<T$1>(gen: () => Generator<unknown, T$1, unknown>): unknown;
3490
4846
  * @param gen - Async generator function that yields monads/promises and returns a result
3491
4847
  * @returns Promise of the same monad type as first yield
3492
4848
  */
3493
- declare function DoAsync<T$1>(gen: () => AsyncGenerator<OptionLike, T$1, unknown>): Promise<Option<T$1>>;
4849
+ declare function DoAsync<T>(gen: () => AsyncGenerator<OptionLike, T, unknown>): Promise<Option<T>>;
3494
4850
  declare function DoAsync<L, R$1>(gen: () => AsyncGenerator<EitherLike, R$1, unknown>): Promise<Either<L, R$1>>;
3495
- declare function DoAsync<T$1>(gen: () => AsyncGenerator<ListLike, T$1, unknown>): Promise<List<T$1>>;
3496
- declare function DoAsync<T$1>(gen: () => AsyncGenerator<TryLike, T$1, unknown>): Promise<Try<T$1>>;
3497
- declare function DoAsync<T$1>(gen: () => AsyncGenerator<OptionLike | EitherLike | ListLike | TryLike, T$1, unknown>): Promise<Reshapeable<T$1>>;
3498
- declare function DoAsync<T$1>(gen: () => AsyncGenerator<unknown, T$1, unknown>): Promise<unknown>;
4851
+ declare function DoAsync<T>(gen: () => AsyncGenerator<ListLike, T, unknown>): Promise<List<T>>;
4852
+ declare function DoAsync<T>(gen: () => AsyncGenerator<TryLike, T, unknown>): Promise<Try<T>>;
4853
+ declare function DoAsync<T>(gen: () => AsyncGenerator<OptionLike | EitherLike | ListLike | TryLike, T, unknown>): Promise<Reshapeable<T>>;
4854
+ declare function DoAsync<T>(gen: () => AsyncGenerator<unknown, T, unknown>): Promise<unknown>;
3499
4855
  /**
3500
4856
  * Helper function to check if a value implements the Doable interface
3501
4857
  * @param value - Value to check
3502
4858
  * @returns True if the value implements Doable
3503
4859
  */
3504
- declare function isDoCapable<T$1>(value: unknown): value is Doable<T$1>;
4860
+ declare function isDoCapable<T>(value: unknown): value is Doable<T>;
3505
4861
  /**
3506
4862
  * Manually unwrap a monad using the Doable interface
3507
4863
  * Useful for testing or when you need to unwrap outside of a Do-comprehension
@@ -3510,7 +4866,7 @@ declare function isDoCapable<T$1>(value: unknown): value is Doable<T$1>;
3510
4866
  * @returns The unwrapped value
3511
4867
  * @throws Error if the monad cannot be unwrapped
3512
4868
  */
3513
- declare function unwrap<T$1>(monad: Doable<T$1>): T$1;
4869
+ declare function unwrap<T>(monad: Doable<T>): T;
3514
4870
  /**
3515
4871
  * Type helper for Do-notation generators.
3516
4872
  * Provides better type hints in IDEs.
@@ -3524,7 +4880,7 @@ declare function unwrap<T$1>(monad: Doable<T$1>): T$1;
3524
4880
  * })
3525
4881
  * ```
3526
4882
  */
3527
- type DoGenerator<T$1, TYield = unknown> = Generator<TYield, T$1, unknown>;
4883
+ type DoGenerator<T, TYield = unknown> = Generator<TYield, T, unknown>;
3528
4884
  /**
3529
4885
  * Extracts values from monads in Do-notation with type inference.
3530
4886
  * The '$' symbol is the universal extraction operator in functional programming.
@@ -3542,11 +4898,11 @@ type DoGenerator<T$1, TYield = unknown> = Generator<TYield, T$1, unknown>;
3542
4898
  * @param monad - Any monad that can be unwrapped (Option, Either, List, Try, etc.)
3543
4899
  * @returns A generator that yields the monad and returns its extracted value
3544
4900
  */
3545
- declare function $<T$1>(monad: Option<T$1>): Generator<Option<T$1>, T$1, T$1>;
4901
+ declare function $<T>(monad: Option<T>): Generator<Option<T>, T, T>;
3546
4902
  declare function $<L, R$1>(monad: Either<L, R$1>): Generator<Either<L, R$1>, R$1, R$1>;
3547
- declare function $<T$1>(monad: List<T$1>): Generator<List<T$1>, T$1, T$1>;
3548
- declare function $<T$1>(monad: Try<T$1>): Generator<Try<T$1>, T$1, T$1>;
3549
- declare function $<T$1>(monad: Doable<T$1>): Generator<Doable<T$1>, T$1, T$1>;
4903
+ declare function $<T>(monad: List<T>): Generator<List<T>, T, T>;
4904
+ declare function $<T>(monad: Try<T>): Generator<Try<T>, T, T>;
4905
+ declare function $<T>(monad: Doable<T>): Generator<Doable<T>, T, T>;
3550
4906
  declare function $<M>(monad: M): Generator<M, InferYieldType<M>, InferYieldType<M>>;
3551
4907
  type InferYieldType<M> = M extends {
3552
4908
  isSome(): boolean;
@@ -3571,5 +4927,5 @@ interface FailureErrorType extends Error {
3571
4927
  }
3572
4928
  declare const FailureError: (cause: Error, message?: string) => FailureErrorType;
3573
4929
  //#endregion
3574
- export { EitherKind as $, isCompanion as $t, OptionConstructor as A, Ok as At, fromBinary as B, createCancellationTokenSource as Bt, Functype as C, ContainerOps as Cn, formatError as Ct, List as D, DoResult as Dn, CancellationToken as Dt, Collection as E, isExtractable as En, Async as Et, Set as F, TaskMetadata as Ft, MatchableUtils as G, NAME as Gt, fromYAML as H, ErrorContext as Ht, SerializationResult as I, TaskOutcome as It, Map$1 as J, Base as Jt, ESMap as K, Throwable as Kt, createCustomSerializer as L, TaskParams as Lt, Stack as M, TaggedThrowable as Mt, Valuable as N, Task as Nt, None as O, Doable as On, CancellationTokenSource as Ot, ValuableParams as P, TaskFailure as Pt, Identity as Q, InstanceType as Qt, createSerializationCompanion as R, TaskResult as Rt, tryCatchAsync as S, CollectionOps as Sn, createErrorSerializer as St, FunctypeCollection as T, Extractable as Tn, safeStringify as Tt, Ref as U, FPromise as Ut, fromJSON as V, isTaggedThrowable as Vt, Matchable as W, FPromiseCompanion as Wt, Traversable as X, Cond as Xt, SafeTraversable as Y, Match as Yt, Lazy as Z, CompanionMethods as Zt, TypeCheckLeft as _, Promisable as _n, ParseError as _t, EmptyListError as a, IntegerNumber as an, UniversalContainer as at, isRight as b, Functor as bn, ErrorWithTaskInfo as bt, LeftError as c, PatternString as cn, FormValidation as ct, isDoCapable as d, UUID as dn, Validator as dt, Companion as en, HKT as et, unwrap as f, UrlString as fn, ErrorCode as ft, TestEither as g, TypeNames as gn, TypedErrorContext as gt, Right as h, Try as hn, TypedError as ht, DoGenerator as i, ISO8601Date as in, TryKind as it, Some as j, Sync as jt, Option as k, Err as kt, LeftErrorType as l, PositiveInteger as ln, Validation as lt, Left as m, ValidatedBrandCompanion as mn, ErrorStatus as mt, Do as n, BoundedString as nn, ListKind as nt, FailureError as o, NonEmptyString as on, FoldableUtils as ot, Either as p, ValidatedBrand as pn, ErrorMessage as pt, ESMapType as q, ThrowableType as qt, DoAsync as r, EmailAddress as rn, OptionKind as rt, FailureErrorType as s, NonNegativeNumber as sn, FieldValidation as st, $ as t, BoundedNumber as tn, Kind as tt, NoneError as u, PositiveNumber as un, ValidationRule as ut, TypeCheckRight as v, Applicative as vn, ErrorChainElement as vt, FunctypeBase as w, LazyList as wn, formatStackTrace as wt, tryCatch as x, Monad as xn, TaskErrorInfo as xt, isLeft as y, AsyncMonad as yn, ErrorFormatterOptions as yt, createSerializer as z, TaskSuccess as zt };
3575
- //# sourceMappingURL=index-Bnjlo4cT.d.ts.map
4930
+ export { TestClockTag as $, Task$1 as $t, OptionConstructor as A, PositiveNumber as An, ValidationRule as At, fromBinary as B, Functor as Bn, ErrorWithTaskInfo as Bt, Functype as C, EmailAddress as Cn, OptionKind as Ct, List as D, NonNegativeNumber as Dn, FieldValidation as Dt, Collection as E, NonEmptyString as En, FoldableUtils as Et, Set as F, Try as Fn, TypedError as Ft, MatchableUtils as G, Extractable as Gn, safeStringify as Gt, fromYAML as H, CollectionOps as Hn, createErrorSerializer as Ht, SerializationResult as I, TypeNames as In, TypedErrorContext as It, Map$1 as J, Doable as Jn, CancellationTokenSource as Jt, ESMap as K, isExtractable as Kn, Async as Kt, createCustomSerializer as L, Promisable as Ln, ParseError as Lt, Stack as M, UrlString as Mn, ErrorCode as Mt, Valuable as N, ValidatedBrand as Nn, ErrorMessage as Nt, None as O, PatternString as On, FormValidation as Ot, ValuableParams as P, ValidatedBrandCompanion as Pn, ErrorStatus as Pt, TestClock as Q, TaggedThrowable as Qt, createSerializationCompanion as R, Applicative as Rn, ErrorChainElement as Rt, tryCatchAsync as S, BoundedString as Sn, ListKind as St, FunctypeCollection as T, IntegerNumber as Tn, UniversalContainer as Tt, Ref as U, ContainerOps as Un, formatError as Ut, fromJSON as V, Monad as Vn, TaskErrorInfo as Vt, Matchable as W, LazyList as Wn, formatStackTrace as Wt, Traversable as X, Ok as Xt, SafeTraversable as Y, Err as Yt, Lazy as Z, Sync as Zt, TypeCheckLeft as _, CompanionMethods as _n, TagService as _t, EmptyListError as a, TaskSuccess as an, TimeoutError as at, isRight as b, Companion as bn, HKT as bt, LeftError as c, ErrorContext as cn, LayerError as ct, isDoCapable as d, NAME as dn, Exit as dt, TaskFailure as en, TestContext as et, unwrap as f, Throwable as fn, ExitTag as ft, TestEither as g, Cond as gn, Tag as gt, Right as h, Match as hn, HasService as ht, DoGenerator as i, TaskResult as in, Task as it, Some as j, UUID as jn, Validator as jt, Option as k, PositiveInteger as kn, Validation as kt, LeftErrorType as l, FPromise as ln, LayerInput as lt, Left as m, Base as mn, ContextServices as mt, Do as n, TaskOutcome as nn, InterruptedError as nt, FailureError as o, createCancellationTokenSource as on, UIO as ot, Either as p, ThrowableType as pn, Context as pt, ESMapType as q, DoResult as qn, CancellationToken as qt, DoAsync as r, TaskParams as rn, RIO as rt, FailureErrorType as s, isTaggedThrowable as sn, Layer as st, $ as t, TaskMetadata as tn, IO as tt, NoneError as u, FPromiseCompanion as un, LayerOutput as ut, TypeCheckRight as v, InstanceType as vn, Identity as vt, FunctypeBase as w, ISO8601Date as wn, TryKind as wt, tryCatch as x, BoundedNumber as xn, Kind as xt, isLeft as y, isCompanion as yn, EitherKind as yt, createSerializer as z, AsyncMonad as zn, ErrorFormatterOptions as zt };
4931
+ //# sourceMappingURL=index-Bn_yRBx8.d.ts.map