functype 0.45.0 → 0.46.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,10 @@
1
- import { t as Brand } from "./Brand-B_uQBKwR.js";
2
- import { c as Pipe, l as Foldable, o as Serializable, r as Typeable, t as Tuple, u as Type } from "./Tuple-35L0I92q.js";
1
+ import { Brand } from "./branded/index.js";
2
+ import { a as Serializable, c as Foldable, l as Type, n as Typeable, s as Pipe } from "./Typeable-E4-aX9Gc.js";
3
+ import { Try } from "./try/index.js";
4
+ import { Set } from "./set/index.js";
5
+ import { Option } from "./option/index.js";
6
+ import { List } from "./list/index.js";
7
+ import { Either } from "./either/index.js";
3
8
 
4
9
  //#region src/error/ParseError.d.ts
5
10
  declare const ParseError: (message?: string) => Error & {
@@ -125,6 +130,16 @@ interface LazyList<A extends Type> extends Foldable<A>, Pipe<LazyList<A>>, Seria
125
130
  dropWhile(predicate: (a: A) => boolean): LazyList<A>;
126
131
  concat(other: LazyList<A>): LazyList<A>;
127
132
  zip<B extends Type>(other: LazyList<B>): LazyList<[A, B]>;
133
+ takeRight(n: number): LazyList<A>;
134
+ reverse(): LazyList<A>;
135
+ distinct(): LazyList<A>;
136
+ zipWithIndex(): LazyList<[A, number]>;
137
+ get head(): A | undefined;
138
+ get headOption(): Option<A>;
139
+ get last(): A | undefined;
140
+ get lastOption(): Option<A>;
141
+ get tail(): LazyList<A>;
142
+ get init(): LazyList<A>;
128
143
  toList(): List<A>;
129
144
  toArray(): A[];
130
145
  forEach(f: (a: A) => void): void;
@@ -133,8 +148,6 @@ interface LazyList<A extends Type> extends Foldable<A>, Pipe<LazyList<A>>, Seria
133
148
  some(predicate: (a: A) => boolean): boolean;
134
149
  every(predicate: (a: A) => boolean): boolean;
135
150
  count(): number;
136
- first(): Option<A>;
137
- last(): Option<A>;
138
151
  toString(): string;
139
152
  }
140
153
  /**
@@ -292,6 +305,34 @@ interface CollectionOps<A extends Type, Self> {
292
305
  * Gets the first element wrapped in Option.
293
306
  */
294
307
  get headOption(): Option<A>;
308
+ /**
309
+ * Takes the first n elements from the collection.
310
+ */
311
+ take(n: number): Self;
312
+ /**
313
+ * Takes elements from the start while the predicate is true.
314
+ */
315
+ takeWhile(p: (a: A) => boolean): Self;
316
+ /**
317
+ * Takes the last n elements from the collection.
318
+ */
319
+ takeRight(n: number): Self;
320
+ /**
321
+ * Gets the last element of the collection.
322
+ */
323
+ get last(): A | undefined;
324
+ /**
325
+ * Gets the last element wrapped in Option.
326
+ */
327
+ get lastOption(): Option<A>;
328
+ /**
329
+ * Gets all elements except the first.
330
+ */
331
+ get tail(): Self;
332
+ /**
333
+ * Gets all elements except the last.
334
+ */
335
+ get init(): Self;
295
336
  /**
296
337
  * Converts the collection to an array.
297
338
  */
@@ -374,96 +415,6 @@ interface Promisable<A extends Type> {
374
415
  toPromise(): Promise<A>;
375
416
  }
376
417
  //#endregion
377
- //#region src/try/Try.d.ts
378
- /**
379
- * Possible types of Try instances
380
- */
381
- type TypeNames = "Success" | "Failure";
382
- interface Try<T> extends FunctypeBase<T, TypeNames>, Extractable<T>, Pipe<T>, Promisable<T>, Doable<T>, Reshapeable<T> {
383
- readonly _tag: TypeNames;
384
- readonly error: Error | undefined;
385
- isSuccess(): this is Try<T> & {
386
- readonly _tag: "Success";
387
- error: undefined;
388
- };
389
- isFailure(): this is Try<T> & {
390
- readonly _tag: "Failure";
391
- error: Error;
392
- };
393
- orElse: (defaultValue: T) => T;
394
- orThrow: (error?: Error) => T;
395
- or: (alternative: Try<T>) => Try<T>;
396
- orNull: () => T | null;
397
- orUndefined: () => T | undefined;
398
- toOption: () => Option<T>;
399
- toEither: <E extends Type>(leftValue: E) => Either<E, T>;
400
- toList: () => List<T>;
401
- toTry: () => Try<T>;
402
- map: <U>(f: (value: T) => U) => Try<U>;
403
- ap: <U>(ff: Try<(value: T) => U>) => Try<U>;
404
- flatMap: <U>(f: (value: T) => Try<U>) => Try<U>;
405
- flatMapAsync: <U>(f: (value: T) => Promise<Try<U>>) => Promise<Try<U>>;
406
- /**
407
- * Pattern matches over the Try, applying onFailure if Failure and onSuccess if Success
408
- * @param onFailure - Function to apply if the Try is Failure
409
- * @param onSuccess - Function to apply if the Try is Success
410
- * @returns The result of applying the appropriate function
411
- */
412
- fold: <U extends Type>(onFailure: (error: Error) => U, onSuccess: (value: T) => U) => U;
413
- toString: () => string;
414
- /**
415
- * Pattern matches over the Try, applying a handler function based on the variant
416
- * @param patterns - Object with handler functions for Success and Failure variants
417
- * @returns The result of applying the matching handler function
418
- */
419
- match<R$1>(patterns: {
420
- Success: (value: T) => R$1;
421
- Failure: (error: Error) => R$1;
422
- }): R$1;
423
- toValue(): {
424
- _tag: TypeNames;
425
- value: T | Error;
426
- };
427
- }
428
- declare const Try: (<T>(f: () => T) => Try<T>) & {
429
- /**
430
- * Type guard to check if a Try is Success
431
- * @param tryValue - The Try to check
432
- * @returns True if Try is Success
433
- */
434
- isSuccess: <T>(tryValue: Try<T>) => tryValue is Try<T> & {
435
- readonly _tag: "Success";
436
- error: undefined;
437
- };
438
- /**
439
- * Type guard to check if a Try is Failure
440
- * @param tryValue - The Try to check
441
- * @returns True if Try is Failure
442
- */
443
- isFailure: <T>(tryValue: Try<T>) => tryValue is Try<T> & {
444
- readonly _tag: "Failure";
445
- error: Error;
446
- };
447
- /**
448
- * Creates a Try from JSON string
449
- * @param json - The JSON string
450
- * @returns Try instance
451
- */
452
- fromJSON: <T>(json: string) => Try<T>;
453
- /**
454
- * Creates a Try from YAML string
455
- * @param yaml - The YAML string
456
- * @returns Try instance
457
- */
458
- fromYAML: <T>(yaml: string) => Try<T>;
459
- /**
460
- * Creates a Try from binary string
461
- * @param binary - The binary string
462
- * @returns Try instance
463
- */
464
- fromBinary: <T>(binary: string) => Try<T>;
465
- };
466
- //#endregion
467
418
  //#region src/reshapeable/Reshapeable.d.ts
468
419
  /**
469
420
  * Interface for types that can be reshaped (converted) between different monadic containers.
@@ -551,18 +502,18 @@ interface Reshapeable<T extends Type> {
551
502
  }
552
503
  //#endregion
553
504
  //#region src/branded/ValidatedBrand.d.ts
554
- type ValidatedBrand<K$1 extends string, T> = Brand<K$1, T> & {
505
+ type ValidatedBrand<K extends string, T> = Brand<K, T> & {
555
506
  readonly __validated: true;
556
507
  };
557
- interface ValidatedBrandCompanion<K$1 extends string, T> {
558
- readonly brand: K$1;
508
+ interface ValidatedBrandCompanion<K extends string, T> {
509
+ readonly brand: K;
559
510
  readonly validate: (value: T) => boolean;
560
- readonly of: (value: T) => Option<ValidatedBrand<K$1, T>>;
561
- readonly from: (value: T) => Either<string, ValidatedBrand<K$1, T>>;
562
- readonly unsafeOf: (value: T) => ValidatedBrand<K$1, T>;
563
- readonly is: (value: unknown) => value is ValidatedBrand<K$1, T>;
564
- readonly unwrap: (branded: Brand<K$1, T>) => T;
565
- readonly refine: <K2 extends string>(brand: K2, validate: (value: Brand<K$1, T>) => boolean) => ValidatedBrandCompanion<K2, Brand<K$1, T>>;
511
+ readonly of: (value: T) => Option<ValidatedBrand<K, T>>;
512
+ readonly from: (value: T) => Either<string, ValidatedBrand<K, T>>;
513
+ readonly unsafeOf: (value: T) => ValidatedBrand<K, T>;
514
+ readonly is: (value: unknown) => value is ValidatedBrand<K, T>;
515
+ readonly unwrap: (branded: Brand<K, T>) => T;
516
+ readonly refine: <K2 extends string>(brand: K2, validate: (value: Brand<K, T>) => boolean) => ValidatedBrandCompanion<K2, Brand<K, T>>;
566
517
  }
567
518
  /**
568
519
  * Create a validated brand with runtime validation
@@ -597,7 +548,7 @@ interface ValidatedBrandCompanion<K$1 extends string, T> {
597
548
  * // ❌ ValidatedBrand("ValidatedUserId", ...) + Brand<"UserId", string>
598
549
  * // ✅ ValidatedBrand("UserId", ...) + Brand<"UserId", string>
599
550
  */
600
- declare function ValidatedBrand<K$1 extends string, T>(brand: K$1, validate: (value: T) => boolean): ValidatedBrandCompanion<K$1, T>;
551
+ declare function ValidatedBrand<K extends string, T>(brand: K, validate: (value: T) => boolean): ValidatedBrandCompanion<K, T>;
601
552
  /**
602
553
  * Positive number brand (> 0)
603
554
  * @example
@@ -835,7 +786,7 @@ declare const Cond: (<T extends Type>() => Cond<T>) & {
835
786
  * "skip": () => defaultValue
836
787
  * })
837
788
  */
838
- match: <T extends string | number | symbol>(value: T) => <R$1 extends Type>(cases: Record<T, R$1 | (() => R$1)>) => R$1;
789
+ match: <T extends string | number | symbol>(value: T) => <R extends Type>(cases: Record<T, R | (() => R)>) => R;
839
790
  /**
840
791
  * Create a lazy conditional that defers evaluation
841
792
  * @example
@@ -882,7 +833,7 @@ type Pattern<T> = T | { [K in keyof T]?: Pattern<T[K]> } | ((value: T) => boolea
882
833
  * Extract result from pattern
883
834
  * @internal
884
835
  */
885
- type PatternResult<T, R$1> = R$1 | ((matched: T) => R$1);
836
+ type PatternResult<T, R> = R | ((matched: T) => R);
886
837
  /**
887
838
  * Untyped Match (before first case is added).
888
839
  * The result type R is inferred when the first case method is called.
@@ -894,23 +845,23 @@ type UntypedMatch<T extends Type> = {
894
845
  /**
895
846
  * Match against a pattern - infers result type R from the result parameter
896
847
  */
897
- case: <R$1 extends Type>(pattern: Pattern<T>, result: PatternResult<T, R$1>) => Match<T, R$1>;
848
+ case: <R extends Type>(pattern: Pattern<T>, result: PatternResult<T, R>) => Match<T, R>;
898
849
  /**
899
850
  * Match a specific value - infers result type R from the result parameter
900
851
  */
901
- caseValue: <R$1 extends Type>(match: T, result: R$1 | (() => R$1)) => Match<T, R$1>;
852
+ caseValue: <R extends Type>(match: T, result: R | (() => R)) => Match<T, R>;
902
853
  /**
903
854
  * Match multiple values - infers result type R from the result parameter
904
855
  */
905
- caseValues: <R$1 extends Type>(matches: T[], result: R$1 | (() => R$1)) => Match<T, R$1>;
856
+ caseValues: <R extends Type>(matches: T[], result: R | (() => R)) => Match<T, R>;
906
857
  /**
907
858
  * Match with a guard function - infers result type R from the result parameter
908
859
  */
909
- when: <R$1 extends Type>(guard: (value: T) => boolean, result: PatternResult<T, R$1>) => Match<T, R$1>;
860
+ when: <R extends Type>(guard: (value: T) => boolean, result: PatternResult<T, R>) => Match<T, R>;
910
861
  /**
911
862
  * Match multiple patterns (OR operation) - infers result type R from the result parameter
912
863
  */
913
- caseAny: <R$1 extends Type>(patterns: Pattern<T>[], result: PatternResult<T, R$1>) => Match<T, R$1>;
864
+ caseAny: <R extends Type>(patterns: Pattern<T>[], result: PatternResult<T, R>) => Match<T, R>;
914
865
  };
915
866
  /**
916
867
  * Pattern matching construct similar to Scala's match expressions.
@@ -939,49 +890,49 @@ type UntypedMatch<T extends Type> = {
939
890
  * .case({ role: "user" }, u => `User: ${u.name}`)
940
891
  * .default("Guest")
941
892
  */
942
- type Match<T extends Type, R$1 extends Type> = {
893
+ type Match<T extends Type, R extends Type> = {
943
894
  /**
944
895
  * Match against a pattern (value, nested object, or predicate).
945
896
  * The result type R2 is added to the union of possible results.
946
897
  */
947
- case: <R2 extends Type>(pattern: Pattern<T>, result: PatternResult<T, R2>) => Match<T, R$1 | R2>;
898
+ case: <R2 extends Type>(pattern: Pattern<T>, result: PatternResult<T, R2>) => Match<T, R | R2>;
948
899
  /**
949
900
  * Add a case that matches a specific value.
950
901
  * The result type R2 is added to the union of possible results.
951
902
  */
952
- caseValue: <R2 extends Type>(match: T, result: R2 | (() => R2)) => Match<T, R$1 | R2>;
903
+ caseValue: <R2 extends Type>(match: T, result: R2 | (() => R2)) => Match<T, R | R2>;
953
904
  /**
954
905
  * Add a case that matches multiple values.
955
906
  * The result type R2 is added to the union of possible results.
956
907
  */
957
- caseValues: <R2 extends Type>(matches: T[], result: R2 | (() => R2)) => Match<T, R$1 | R2>;
908
+ caseValues: <R2 extends Type>(matches: T[], result: R2 | (() => R2)) => Match<T, R | R2>;
958
909
  /**
959
910
  * Match with a guard function (alias for readability).
960
911
  * The result type R2 is added to the union of possible results.
961
912
  */
962
- when: <R2 extends Type>(guard: (value: T) => boolean, result: PatternResult<T, R2>) => Match<T, R$1 | R2>;
913
+ when: <R2 extends Type>(guard: (value: T) => boolean, result: PatternResult<T, R2>) => Match<T, R | R2>;
963
914
  /**
964
915
  * Match multiple patterns (OR operation).
965
916
  * The result type R2 is added to the union of possible results.
966
917
  */
967
- caseAny: <R2 extends Type>(patterns: Pattern<T>[], result: PatternResult<T, R2>) => Match<T, R$1 | R2>;
918
+ caseAny: <R2 extends Type>(patterns: Pattern<T>[], result: PatternResult<T, R2>) => Match<T, R | R2>;
968
919
  /**
969
920
  * Default case - makes match non-exhaustive.
970
921
  * The result type R2 is added to the union of possible results.
971
922
  */
972
- default: <R2 extends Type>(result: PatternResult<T, R2>) => R$1 | R2;
923
+ default: <R2 extends Type>(result: PatternResult<T, R2>) => R | R2;
973
924
  /**
974
925
  * Force exhaustive matching (compile-time check for union types)
975
926
  */
976
- exhaustive: () => R$1;
927
+ exhaustive: () => R;
977
928
  /**
978
929
  * Get result if matched, throws if no match
979
930
  */
980
- orThrow: (errorMessage?: string) => R$1;
931
+ orThrow: (errorMessage?: string) => R;
981
932
  /**
982
933
  * Get result wrapped in Option
983
934
  */
984
- toOption: () => Option<R$1>;
935
+ toOption: () => Option<R>;
985
936
  };
986
937
  /**
987
938
  * Pattern matching utility for type-safe conditional logic with exhaustiveness checking,
@@ -1047,7 +998,7 @@ declare const Match: (<T extends Type>(value: T) => UntypedMatch<T>) & {
1047
998
  * const compute = ops("multiply").fn
1048
999
  * const result = compute(4, 5) // 20
1049
1000
  */
1050
- exhaustive: <T extends string | number | symbol, R$1 extends Type>(cases: RequireExhaustive<T, Record<T, R$1>>) => (value: T) => R$1;
1001
+ exhaustive: <T extends string | number | symbol, R extends Type>(cases: RequireExhaustive<T, Record<T, R>>) => (value: T) => R;
1051
1002
  /**
1052
1003
  * Create a partial match that requires a default
1053
1004
  * @example
@@ -1069,8 +1020,8 @@ declare const Match: (<T extends Type>(value: T) => UntypedMatch<T>) & {
1069
1020
  * }).withDefault((n) => `Number: ${n}`)
1070
1021
  * getMessage(5) // "Number: 5"
1071
1022
  */
1072
- partial: <T extends string | number | symbol, R$1 extends Type>(cases: Partial<Record<T, R$1 | ((value: T) => R$1)>>) => {
1073
- withDefault: (defaultValue: R$1 | ((value: T) => R$1)) => (value: T) => R$1;
1023
+ partial: <T extends string | number | symbol, R extends Type>(cases: Partial<Record<T, R | ((value: T) => R)>>) => {
1024
+ withDefault: (defaultValue: R | ((value: T) => R)) => (value: T) => R;
1074
1025
  };
1075
1026
  /**
1076
1027
  * Pattern match with guards
@@ -1095,8 +1046,8 @@ declare const Match: (<T extends Type>(value: T) => UntypedMatch<T>) & {
1095
1046
  * ]).withDefault("Unknown")(age)
1096
1047
  * // category = "Adult (25 years)"
1097
1048
  */
1098
- withGuards: <T extends Type, R$1 extends Type>(guards: Array<[(value: T) => boolean, R$1 | ((value: T) => R$1)]>) => {
1099
- withDefault: (defaultValue: R$1 | ((value: T) => R$1)) => (value: T) => R$1;
1049
+ withGuards: <T extends Type, R extends Type>(guards: Array<[(value: T) => boolean, R | ((value: T) => R)]>) => {
1050
+ withDefault: (defaultValue: R | ((value: T) => R)) => (value: T) => R;
1100
1051
  };
1101
1052
  /**
1102
1053
  * Pattern matching for objects with specific structure
@@ -1112,9 +1063,9 @@ declare const Match: (<T extends Type>(value: T) => UntypedMatch<T>) & {
1112
1063
  * .case({ type: "hover" }, (e) => console.log(`Hovering over ${e.element}`))
1113
1064
  * .build()
1114
1065
  */
1115
- struct: <T extends Type, R$1 extends Type>() => {
1116
- case: (pattern: Pattern<T>, handler: (value: T) => R$1) => /*elided*/any;
1117
- build: () => (value: T) => R$1;
1066
+ struct: <T extends Type, R extends Type>() => {
1067
+ case: (pattern: Pattern<T>, handler: (value: T) => R) => /*elided*/any;
1068
+ build: () => (value: T) => R;
1118
1069
  };
1119
1070
  /**
1120
1071
  * Create a pattern matcher with guards and nested patterns
@@ -1131,11 +1082,11 @@ declare const Match: (<T extends Type>(value: T) => UntypedMatch<T>) & {
1131
1082
  * .default(false)
1132
1083
  * .build()
1133
1084
  */
1134
- builder: <T extends Type, R$1 extends Type>() => {
1135
- case: (pattern: Pattern<T>, result: PatternResult<T, R$1>) => /*elided*/any;
1136
- when: (guard: (value: T) => boolean, result: PatternResult<T, R$1>) => /*elided*/any;
1137
- default: (result: PatternResult<T, R$1>) => {
1138
- build: () => (value: T) => R$1;
1085
+ builder: <T extends Type, R extends Type>() => {
1086
+ case: (pattern: Pattern<T>, result: PatternResult<T, R>) => /*elided*/any;
1087
+ when: (guard: (value: T) => boolean, result: PatternResult<T, R>) => /*elided*/any;
1088
+ default: (result: PatternResult<T, R>) => {
1089
+ build: () => (value: T) => R;
1139
1090
  };
1140
1091
  };
1141
1092
  };
@@ -1274,11 +1225,8 @@ type TaskResult<T> = Promise<TaskOutcome<T>>;
1274
1225
  * Cancellation is cooperative, meaning the task must check the token and respond to cancellation requests
1275
1226
  */
1276
1227
  type CancellationToken = {
1277
- /** Whether the token has been cancelled */
1278
- readonly isCancelled: boolean;
1279
- /** Signal that can be used with fetch and other abortable APIs */
1280
- readonly signal: AbortSignal;
1281
- /** Register a callback to be called when cancellation occurs */
1228
+ /** Whether the token has been cancelled */readonly isCancelled: boolean; /** Signal that can be used with fetch and other abortable APIs */
1229
+ readonly signal: AbortSignal; /** Register a callback to be called when cancellation occurs */
1282
1230
  onCancel(callback: () => void): void;
1283
1231
  };
1284
1232
  /**
@@ -1286,9 +1234,7 @@ type CancellationToken = {
1286
1234
  * The controller can be used to cancel operations that use the token
1287
1235
  */
1288
1236
  type CancellationTokenSource = {
1289
- /** The token to be passed to cancellable operations */
1290
- readonly token: CancellationToken;
1291
- /** Cancel all operations using this token */
1237
+ /** The token to be passed to cancellable operations */readonly token: CancellationToken; /** Cancel all operations using this token */
1292
1238
  cancel(): void;
1293
1239
  };
1294
1240
  /**
@@ -1473,19 +1419,12 @@ type ErrorChainElement = {
1473
1419
  * Options for formatting error chains
1474
1420
  */
1475
1421
  type ErrorFormatterOptions = {
1476
- /** Include task names in the formatted output */
1477
- includeTasks?: boolean;
1478
- /** Include stack traces in the formatted output */
1479
- includeStackTrace?: boolean;
1480
- /** Separator between error lines (default: newline) */
1481
- separator?: string;
1482
- /** Include detailed error data in the output */
1483
- includeData?: boolean;
1484
- /** Maximum number of stack frames to include if stack trace is enabled */
1485
- maxStackFrames?: number;
1486
- /** Title to display at the start of the formatted error */
1487
- title?: string;
1488
- /** Format the output with colors for console display */
1422
+ /** Include task names in the formatted output */includeTasks?: boolean; /** Include stack traces in the formatted output */
1423
+ includeStackTrace?: boolean; /** Separator between error lines (default: newline) */
1424
+ separator?: string; /** Include detailed error data in the output */
1425
+ includeData?: boolean; /** Maximum number of stack frames to include if stack trace is enabled */
1426
+ maxStackFrames?: number; /** Title to display at the start of the formatted error */
1427
+ title?: string; /** Format the output with colors for console display */
1489
1428
  colors?: boolean;
1490
1429
  };
1491
1430
  /**
@@ -1962,7 +1901,7 @@ type TagService<T> = T extends Tag<infer S> ? S : never;
1962
1901
  * const loggerUnsafe = ctx.unsafeGet(Logger) // Logger (throws if missing)
1963
1902
  * ```
1964
1903
  */
1965
- interface Context<R$1 extends Type> {
1904
+ interface Context<R extends Type> {
1966
1905
  /**
1967
1906
  * Type brand
1968
1907
  * @internal
@@ -1972,7 +1911,7 @@ interface Context<R$1 extends Type> {
1972
1911
  * Phantom type for requirements
1973
1912
  * @internal
1974
1913
  */
1975
- readonly _R?: R$1;
1914
+ readonly _R?: R;
1976
1915
  /**
1977
1916
  * Internal service map
1978
1917
  * @internal
@@ -2003,13 +1942,13 @@ interface Context<R$1 extends Type> {
2003
1942
  * @param service - The service implementation
2004
1943
  * @returns A new context with the service added
2005
1944
  */
2006
- add<S extends Type>(tag: Tag<S>, service: S): Context<R$1 & S>;
1945
+ add<S extends Type>(tag: Tag<S>, service: S): Context<R & S>;
2007
1946
  /**
2008
1947
  * Merges another context into this one.
2009
1948
  * @param other - The context to merge
2010
1949
  * @returns A new context with all services from both
2011
1950
  */
2012
- merge<R2 extends Type>(other: Context<R2>): Context<R$1 & R2>;
1951
+ merge<R2 extends Type>(other: Context<R2>): Context<R & R2>;
2013
1952
  /**
2014
1953
  * Returns the number of services in this context.
2015
1954
  */
@@ -2026,7 +1965,7 @@ declare const Context: {
2026
1965
  /**
2027
1966
  * Creates an empty context with no services.
2028
1967
  */
2029
- empty: <R$1 extends Type = never>() => Context<R$1>;
1968
+ empty: <R extends Type = never>() => Context<R>;
2030
1969
  /**
2031
1970
  * Creates a context with a single service.
2032
1971
  * @param tag - The tag for the service
@@ -2036,7 +1975,7 @@ declare const Context: {
2036
1975
  /**
2037
1976
  * Checks if a value is a Context.
2038
1977
  */
2039
- isContext: <R$1 extends Type>(value: unknown) => value is Context<R$1>;
1978
+ isContext: <R extends Type>(value: unknown) => value is Context<R>;
2040
1979
  };
2041
1980
  /**
2042
1981
  * Type helper to extract requirements from a Context
@@ -2332,7 +2271,7 @@ declare const Layer: {
2332
2271
  * Creates a layer from a context.
2333
2272
  * @param context - The context to use
2334
2273
  */
2335
- fromContext: <R$1 extends Type>(context: Context<R$1>) => Layer<never, never, R$1>;
2274
+ fromContext: <R extends Type>(context: Context<R>) => Layer<never, never, R>;
2336
2275
  /**
2337
2276
  * Creates an empty layer that provides nothing.
2338
2277
  */
@@ -2391,7 +2330,7 @@ declare class InterruptedError extends Error {
2391
2330
  /**
2392
2331
  * Internal effect representation types
2393
2332
  */
2394
- type IOEffect<R$1, E, A> = {
2333
+ type IOEffect<R, E, A> = {
2395
2334
  readonly _tag: "Sync";
2396
2335
  readonly thunk: () => A;
2397
2336
  } | {
@@ -2413,48 +2352,48 @@ type IOEffect<R$1, E, A> = {
2413
2352
  readonly _tag: "Interrupt";
2414
2353
  } | {
2415
2354
  readonly _tag: "FlatMap";
2416
- readonly effect: IO<R$1, E, unknown>;
2417
- readonly f: (a: unknown) => IO<R$1, E, A>;
2355
+ readonly effect: IO<R, E, unknown>;
2356
+ readonly f: (a: unknown) => IO<R, E, A>;
2418
2357
  } | {
2419
2358
  readonly _tag: "Map";
2420
- readonly effect: IO<R$1, E, unknown>;
2359
+ readonly effect: IO<R, E, unknown>;
2421
2360
  readonly f: (a: unknown) => A;
2422
2361
  } | {
2423
2362
  readonly _tag: "MapError";
2424
- readonly effect: IO<R$1, unknown, A>;
2363
+ readonly effect: IO<R, unknown, A>;
2425
2364
  readonly f: (e: unknown) => E;
2426
2365
  } | {
2427
2366
  readonly _tag: "Recover";
2428
- readonly effect: IO<R$1, E, A>;
2367
+ readonly effect: IO<R, E, A>;
2429
2368
  readonly fallback: A;
2430
2369
  } | {
2431
2370
  readonly _tag: "RecoverWith";
2432
- readonly effect: IO<R$1, E, A>;
2433
- readonly f: (e: E) => IO<R$1, E, A>;
2371
+ readonly effect: IO<R, E, A>;
2372
+ readonly f: (e: E) => IO<R, E, A>;
2434
2373
  } | {
2435
2374
  readonly _tag: "Fold";
2436
- readonly effect: IO<R$1, E, unknown>;
2375
+ readonly effect: IO<R, E, unknown>;
2437
2376
  readonly onFailure: (e: E) => A;
2438
2377
  readonly onSuccess: (a: unknown) => A;
2439
2378
  } | {
2440
2379
  readonly _tag: "Bracket";
2441
- readonly acquire: IO<R$1, E, unknown>;
2442
- readonly use: (a: unknown) => IO<R$1, E, A>;
2443
- readonly release: (a: unknown) => IO<R$1, never, void>;
2380
+ readonly acquire: IO<R, E, unknown>;
2381
+ readonly use: (a: unknown) => IO<R, E, A>;
2382
+ readonly release: (a: unknown) => IO<R, never, void>;
2444
2383
  } | {
2445
2384
  readonly _tag: "Race";
2446
- readonly effects: readonly IO<R$1, E, A>[];
2385
+ readonly effects: readonly IO<R, E, A>[];
2447
2386
  } | {
2448
2387
  readonly _tag: "Timeout";
2449
- readonly effect: IO<R$1, E, A>;
2388
+ readonly effect: IO<R, E, A>;
2450
2389
  readonly duration: number;
2451
2390
  } | {
2452
2391
  readonly _tag: "Service";
2453
2392
  readonly tag: Tag<A>;
2454
2393
  } | {
2455
2394
  readonly _tag: "ProvideContext";
2456
- readonly effect: IO<R$1, E, A>;
2457
- readonly context: Context<R$1>;
2395
+ readonly effect: IO<R, E, A>;
2396
+ readonly context: Context<R>;
2458
2397
  };
2459
2398
  /**
2460
2399
  * IO<R, E, A> represents a lazy, composable effect.
@@ -2463,17 +2402,17 @@ type IOEffect<R$1, E, A> = {
2463
2402
  * @typeParam E - Error type (typed failures)
2464
2403
  * @typeParam A - Success type (value produced on success)
2465
2404
  */
2466
- interface IO<R$1 extends Type, E extends Type, A extends Type> {
2405
+ interface IO<R extends Type, E extends Type, A extends Type> {
2467
2406
  /**
2468
2407
  * Internal effect representation
2469
2408
  * @internal
2470
2409
  */
2471
- readonly _effect: IOEffect<R$1, E, A>;
2410
+ readonly _effect: IOEffect<R, E, A>;
2472
2411
  /**
2473
2412
  * Phantom type for requirements
2474
2413
  * @internal
2475
2414
  */
2476
- readonly _R?: R$1;
2415
+ readonly _R?: R;
2477
2416
  /**
2478
2417
  * Phantom type for error
2479
2418
  * @internal
@@ -2489,31 +2428,31 @@ interface IO<R$1 extends Type, E extends Type, A extends Type> {
2489
2428
  * @param f - Function to apply to the success value
2490
2429
  * @returns New IO with transformed value
2491
2430
  */
2492
- map<B extends Type>(f: (a: A) => B): IO<R$1, E, B>;
2431
+ map<B extends Type>(f: (a: A) => B): IO<R, E, B>;
2493
2432
  /**
2494
2433
  * Chains another IO effect based on the success value.
2495
2434
  * @param f - Function returning next IO effect
2496
2435
  * @returns New IO with combined effects
2497
2436
  */
2498
- flatMap<R2 extends Type, E2 extends Type, B extends Type>(f: (a: A) => IO<R2, E2, B>): IO<R$1 | R2, E | E2, B>;
2437
+ flatMap<R2 extends Type, E2 extends Type, B extends Type>(f: (a: A) => IO<R2, E2, B>): IO<R | R2, E | E2, B>;
2499
2438
  /**
2500
2439
  * Applies a side effect without changing the value.
2501
2440
  * @param f - Side effect function
2502
2441
  * @returns Same IO for chaining
2503
2442
  */
2504
- tap(f: (a: A) => void): IO<R$1, E, A>;
2443
+ tap(f: (a: A) => void): IO<R, E, A>;
2505
2444
  /**
2506
2445
  * Applies an effectful side effect without changing the value.
2507
2446
  * @param f - Function returning IO for side effect
2508
2447
  * @returns Same value after running side effect
2509
2448
  */
2510
- tapEffect<R2 extends Type, E2 extends Type, B extends Type>(f: (a: A) => IO<R2, E2, B>): IO<R$1 | R2, E | E2, A>;
2449
+ tapEffect<R2 extends Type, E2 extends Type, B extends Type>(f: (a: A) => IO<R2, E2, B>): IO<R | R2, E | E2, A>;
2511
2450
  /**
2512
2451
  * Transforms the error value.
2513
2452
  * @param f - Function to apply to the error
2514
2453
  * @returns New IO with transformed error
2515
2454
  */
2516
- mapError<E2 extends Type>(f: (e: E) => E2): IO<R$1, E2, A>;
2455
+ mapError<E2 extends Type>(f: (e: E) => E2): IO<R, E2, A>;
2517
2456
  /**
2518
2457
  * Executes a side effect on the error without changing it.
2519
2458
  * Useful for logging errors while preserving the error chain.
@@ -2528,92 +2467,92 @@ interface IO<R$1 extends Type, E extends Type, A extends Type> {
2528
2467
  * .map(data => transform(data))
2529
2468
  * ```
2530
2469
  */
2531
- tapError(f: (e: E) => void): IO<R$1, E, A>;
2470
+ tapError(f: (e: E) => void): IO<R, E, A>;
2532
2471
  /**
2533
2472
  * Recovers from any error with a fallback value.
2534
2473
  * @param fallback - Value to use on error
2535
2474
  * @returns New IO that never fails
2536
2475
  */
2537
- recover<B extends Type>(fallback: B): IO<R$1, never, A | B>;
2476
+ recover<B extends Type>(fallback: B): IO<R, never, A | B>;
2538
2477
  /**
2539
2478
  * Recovers from error by running another effect.
2540
2479
  * @param f - Function returning recovery effect
2541
2480
  * @returns New IO with error handling
2542
2481
  */
2543
- recoverWith<R2 extends Type, E2 extends Type, B extends Type>(f: (e: E) => IO<R2, E2, B>): IO<R$1 | R2, E2, A | B>;
2482
+ recoverWith<R2 extends Type, E2 extends Type, B extends Type>(f: (e: E) => IO<R2, E2, B>): IO<R | R2, E2, A | B>;
2544
2483
  /**
2545
2484
  * Pattern matches on success and failure.
2546
2485
  * @param onFailure - Handler for failures
2547
2486
  * @param onSuccess - Handler for successes
2548
2487
  * @returns New IO with handled result
2549
2488
  */
2550
- fold<B extends Type>(onFailure: (e: E) => B, onSuccess: (a: A) => B): IO<R$1, never, B>;
2489
+ fold<B extends Type>(onFailure: (e: E) => B, onSuccess: (a: A) => B): IO<R, never, B>;
2551
2490
  /**
2552
2491
  * Pattern matches with object pattern syntax.
2553
2492
  */
2554
2493
  match<B extends Type>(patterns: {
2555
2494
  failure: (e: E) => B;
2556
2495
  success: (a: A) => B;
2557
- }): IO<R$1, never, B>;
2496
+ }): IO<R, never, B>;
2558
2497
  /**
2559
2498
  * Catches errors with a specific tag and handles them.
2560
2499
  * @param tag - The error tag to catch
2561
2500
  * @param handler - Handler for the caught error
2562
2501
  */
2563
- catchTag<K$1 extends (E extends {
2502
+ catchTag<K extends (E extends {
2564
2503
  _tag: string;
2565
- } ? E["_tag"] : never), R2 extends Type, E2 extends Type, B extends Type>(tag: K$1, handler: (e: Extract<E, {
2566
- _tag: K$1;
2567
- }>) => IO<R2, E2, B>): IO<R$1 | R2, Exclude<E, {
2568
- _tag: K$1;
2504
+ } ? E["_tag"] : never), R2 extends Type, E2 extends Type, B extends Type>(tag: K, handler: (e: Extract<E, {
2505
+ _tag: K;
2506
+ }>) => IO<R2, E2, B>): IO<R | R2, Exclude<E, {
2507
+ _tag: K;
2569
2508
  }> | E2, A | B>;
2570
2509
  /**
2571
2510
  * Catches all errors (alias for recoverWith).
2572
2511
  */
2573
- catchAll<R2 extends Type, E2 extends Type, B extends Type>(handler: (e: E) => IO<R2, E2, B>): IO<R$1 | R2, E2, A | B>;
2512
+ catchAll<R2 extends Type, E2 extends Type, B extends Type>(handler: (e: E) => IO<R2, E2, B>): IO<R | R2, E2, A | B>;
2574
2513
  /**
2575
2514
  * Retries the effect up to n times on failure.
2576
2515
  * @param n - Maximum number of retries
2577
2516
  */
2578
- retry(n: number): IO<R$1, E, A>;
2517
+ retry(n: number): IO<R, E, A>;
2579
2518
  /**
2580
2519
  * Retries the effect with a delay between attempts.
2581
2520
  * @param n - Maximum number of retries
2582
2521
  * @param delayMs - Delay between retries in milliseconds
2583
2522
  */
2584
- retryWithDelay(n: number, delayMs: number): IO<R$1, E, A>;
2523
+ retryWithDelay(n: number, delayMs: number): IO<R, E, A>;
2585
2524
  /**
2586
2525
  * Sequences two IOs, keeping the second value.
2587
2526
  */
2588
- zipRight<R2 extends Type, E2 extends Type, B extends Type>(that: IO<R2, E2, B>): IO<R$1 | R2, E | E2, B>;
2527
+ zipRight<R2 extends Type, E2 extends Type, B extends Type>(that: IO<R2, E2, B>): IO<R | R2, E | E2, B>;
2589
2528
  /**
2590
2529
  * Sequences two IOs, keeping the first value.
2591
2530
  */
2592
- zipLeft<R2 extends Type, E2 extends Type, B extends Type>(that: IO<R2, E2, B>): IO<R$1 | R2, E | E2, A>;
2531
+ zipLeft<R2 extends Type, E2 extends Type, B extends Type>(that: IO<R2, E2, B>): IO<R | R2, E | E2, A>;
2593
2532
  /**
2594
2533
  * Zips two IOs into a tuple.
2595
2534
  */
2596
- zip<R2 extends Type, E2 extends Type, B extends Type>(that: IO<R2, E2, B>): IO<R$1 | R2, E | E2, readonly [A, B]>;
2535
+ zip<R2 extends Type, E2 extends Type, B extends Type>(that: IO<R2, E2, B>): IO<R | R2, E | E2, readonly [A, B]>;
2597
2536
  /**
2598
2537
  * Flattens a nested IO.
2599
2538
  */
2600
- 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>;
2539
+ flatten<R2 extends Type, E2 extends Type, B extends Type>(this: IO<R, E, IO<R2, E2, B>>): IO<R | R2, E | E2, B>;
2601
2540
  /**
2602
2541
  * Provides a context to satisfy the requirements of this effect.
2603
2542
  * @param context - The context containing required services
2604
2543
  */
2605
- provideContext<R2 extends R$1>(context: Context<R2>): IO<Exclude<R$1, R2>, E, A>;
2544
+ provideContext<R2 extends R>(context: Context<R2>): IO<Exclude<R, R2>, E, A>;
2606
2545
  /**
2607
2546
  * Provides a single service to satisfy part of the requirements.
2608
2547
  * @param tag - The service tag
2609
2548
  * @param service - The service implementation
2610
2549
  */
2611
- provideService<S extends Type>(tag: Tag<S>, service: S): IO<Exclude<R$1, S>, E, A>;
2550
+ provideService<S extends Type>(tag: Tag<S>, service: S): IO<Exclude<R, S>, E, A>;
2612
2551
  /**
2613
2552
  * Provides services using a layer.
2614
2553
  * @param layer - The layer that provides services
2615
2554
  */
2616
- 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>;
2555
+ provideLayer<RIn extends Type, E2 extends Type, ROut extends R>(layer: Layer<RIn, E2, ROut>): IO<RIn | Exclude<R, ROut>, E | E2, A>;
2617
2556
  /**
2618
2557
  * Runs the effect and returns an Either. Never throws.
2619
2558
  * This is the safe default - all errors become Left.
@@ -2656,22 +2595,22 @@ interface IO<R$1 extends Type, E extends Type, A extends Type> {
2656
2595
  /**
2657
2596
  * Pipes the IO through a function.
2658
2597
  */
2659
- pipe<B>(f: (self: IO<R$1, E, A>) => B): B;
2598
+ pipe<B>(f: (self: IO<R, E, A>) => B): B;
2660
2599
  /**
2661
2600
  * Delays execution by the specified milliseconds.
2662
2601
  */
2663
- delay(ms: number): IO<R$1, E, A>;
2602
+ delay(ms: number): IO<R, E, A>;
2664
2603
  /**
2665
2604
  * Fails with TimeoutError if the effect doesn't complete within the specified duration.
2666
2605
  * @param ms - Maximum time in milliseconds
2667
2606
  */
2668
- timeout(ms: number): IO<R$1, E | TimeoutError, A>;
2607
+ timeout(ms: number): IO<R, E | TimeoutError, A>;
2669
2608
  /**
2670
2609
  * Returns a fallback value if the effect doesn't complete within the specified duration.
2671
2610
  * @param ms - Maximum time in milliseconds
2672
2611
  * @param fallback - Value to return on timeout
2673
2612
  */
2674
- timeoutTo<B extends Type>(ms: number, fallback: B): IO<R$1, E, A | B>;
2613
+ timeoutTo<B extends Type>(ms: number, fallback: B): IO<R, E, A | B>;
2675
2614
  /**
2676
2615
  * Converts to string representation.
2677
2616
  */
@@ -2687,52 +2626,52 @@ interface IO<R$1 extends Type, E extends Type, A extends Type> {
2687
2626
  * Makes IO iterable for generator do-notation (yield* syntax).
2688
2627
  * Yields the IO itself, allowing IO.gen to extract the value.
2689
2628
  */
2690
- [Symbol.iterator](): Generator<IO<R$1, E, A>, A, A>;
2629
+ [Symbol.iterator](): Generator<IO<R, E, A>, A, A>;
2691
2630
  }
2692
2631
  /**
2693
2632
  * Do-builder interface for chaining binds and maps
2694
2633
  */
2695
- interface DoBuilder<R$1 extends Type, E extends Type, Ctx extends Record<string, Type>> {
2634
+ interface DoBuilder<R extends Type, E extends Type, Ctx extends Record<string, Type>> {
2696
2635
  /**
2697
2636
  * The underlying IO effect
2698
2637
  */
2699
- readonly effect: IO<R$1, E, Ctx>;
2638
+ readonly effect: IO<R, E, Ctx>;
2700
2639
  /**
2701
2640
  * Binds the result of an effect to a named property in the context.
2702
2641
  * @param name - The property name to bind to
2703
2642
  * @param f - Function that returns an IO effect (receives current context)
2704
2643
  */
2705
- 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>>;
2644
+ 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 | R2, E | E2, Ctx & Record<N, A>>;
2706
2645
  /**
2707
2646
  * Binds a pure value to a named property in the context.
2708
2647
  * @param name - The property name to bind to
2709
2648
  * @param f - Function that returns a value (receives current context)
2710
2649
  */
2711
- let<N extends string, A extends Type>(name: Exclude<N, keyof Ctx>, f: (ctx: Ctx) => A): DoBuilder<R$1, E, Ctx & Record<N, A>>;
2650
+ let<N extends string, A extends Type>(name: Exclude<N, keyof Ctx>, f: (ctx: Ctx) => A): DoBuilder<R, E, Ctx & Record<N, A>>;
2712
2651
  /**
2713
2652
  * Transforms the final context value.
2714
2653
  * @param f - Function to transform the context
2715
2654
  */
2716
- map<B extends Type>(f: (ctx: Ctx) => B): IO<R$1, E, B>;
2655
+ map<B extends Type>(f: (ctx: Ctx) => B): IO<R, E, B>;
2717
2656
  /**
2718
2657
  * Chains to another IO based on the context.
2719
2658
  * @param f - Function that returns an IO effect
2720
2659
  */
2721
- flatMap<R2 extends Type, E2 extends Type, B extends Type>(f: (ctx: Ctx) => IO<R2, E2, B>): IO<R$1 | R2, E | E2, B>;
2660
+ flatMap<R2 extends Type, E2 extends Type, B extends Type>(f: (ctx: Ctx) => IO<R2, E2, B>): IO<R | R2, E | E2, B>;
2722
2661
  /**
2723
2662
  * Executes a side effect without changing the context.
2724
2663
  * @param f - Side effect function
2725
2664
  */
2726
- tap(f: (ctx: Ctx) => void): DoBuilder<R$1, E, Ctx>;
2665
+ tap(f: (ctx: Ctx) => void): DoBuilder<R, E, Ctx>;
2727
2666
  /**
2728
2667
  * Executes an effectful side effect without changing the context.
2729
2668
  * @param f - Function returning an IO for the side effect
2730
2669
  */
2731
- tapEffect<R2 extends Type, E2 extends Type, B extends Type>(f: (ctx: Ctx) => IO<R2, E2, B>): DoBuilder<R$1 | R2, E | E2, Ctx>;
2670
+ tapEffect<R2 extends Type, E2 extends Type, B extends Type>(f: (ctx: Ctx) => IO<R2, E2, B>): DoBuilder<R | R2, E | E2, Ctx>;
2732
2671
  /**
2733
2672
  * Returns the final context as is.
2734
2673
  */
2735
- done(): IO<R$1, E, Ctx>;
2674
+ done(): IO<R, E, Ctx>;
2736
2675
  }
2737
2676
  /**
2738
2677
  * IO effect type for lazy, composable effects with typed errors.
@@ -2945,7 +2884,7 @@ declare const IO: (<A extends Type>(f: () => A | Promise<A>) => IO<never, unknow
2945
2884
  /**
2946
2885
  * Accesses a service and applies an effectful function to it.
2947
2886
  */
2948
- 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>;
2887
+ serviceWithIO: <S extends Type, R extends Type, E extends Type, A extends Type>(tag: Tag<S>, f: (service: S) => IO<R, E, A>) => IO<S | R, E, A>;
2949
2888
  /**
2950
2889
  * Accesses multiple services and applies a function to them.
2951
2890
  * Provides a convenient way to work with multiple dependencies.
@@ -2965,11 +2904,11 @@ declare const IO: (<A extends Type>(f: () => A | Promise<A>) => IO<never, unknow
2965
2904
  /**
2966
2905
  * Runs all IOs in parallel and collects results.
2967
2906
  */
2968
- all: <R$1 extends Type, E extends Type, A extends Type>(effects: readonly IO<R$1, E, A>[]) => IO<R$1, E, readonly A[]>;
2907
+ all: <R extends Type, E extends Type, A extends Type>(effects: readonly IO<R, E, A>[]) => IO<R, E, readonly A[]>;
2969
2908
  /**
2970
2909
  * Runs IOs in sequence, returning the first success or last failure.
2971
2910
  */
2972
- firstSuccessOf: <R$1 extends Type, E extends Type, A extends Type>(effects: readonly IO<R$1, E, A>[]) => IO<R$1, E, A>;
2911
+ firstSuccessOf: <R extends Type, E extends Type, A extends Type>(effects: readonly IO<R, E, A>[]) => IO<R, E, A>;
2973
2912
  /**
2974
2913
  * Creates an IO that sleeps for the specified duration.
2975
2914
  */
@@ -3003,11 +2942,11 @@ declare const IO: (<A extends Type>(f: () => A | Promise<A>) => IO<never, unknow
3003
2942
  * )
3004
2943
  * ```
3005
2944
  */
3006
- 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>;
2945
+ bracket: <R extends Type, E extends Type, A extends Type, B extends Type>(acquire: IO<R, E, A>, use: (a: A) => IO<R, E, B>, release: (a: A) => IO<R, never, void>) => IO<R, E, B>;
3007
2946
  /**
3008
2947
  * Alias for bracket with a more descriptive name.
3009
2948
  */
3010
- 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>;
2949
+ acquireRelease: <R extends Type, E extends Type, A extends Type, B extends Type>(acquire: IO<R, E, A>, use: (a: A) => IO<R, E, B>, release: (a: A) => IO<R, never, void>) => IO<R, E, B>;
3011
2950
  /**
3012
2951
  * Races multiple effects, returning the first to complete.
3013
2952
  * Note: Other effects are NOT cancelled (JS limitation).
@@ -3020,7 +2959,7 @@ declare const IO: (<A extends Type>(f: () => A | Promise<A>) => IO<never, unknow
3020
2959
  * ]).run() // "fast"
3021
2960
  * ```
3022
2961
  */
3023
- race: <R$1 extends Type, E extends Type, A extends Type>(effects: readonly IO<R$1, E, A>[]) => IO<R$1, E, A>;
2962
+ race: <R extends Type, E extends Type, A extends Type>(effects: readonly IO<R, E, A>[]) => IO<R, E, A>;
3024
2963
  /**
3025
2964
  * Returns the first effect to succeed, or fails if all fail.
3026
2965
  *
@@ -3033,7 +2972,7 @@ declare const IO: (<A extends Type>(f: () => A | Promise<A>) => IO<never, unknow
3033
2972
  * ]).run() // "success"
3034
2973
  * ```
3035
2974
  */
3036
- any: <R$1 extends Type, E extends Type, A extends Type>(effects: readonly IO<R$1, E, A>[]) => IO<R$1, E, A>;
2975
+ any: <R extends Type, E extends Type, A extends Type>(effects: readonly IO<R, E, A>[]) => IO<R, E, A>;
3037
2976
  /**
3038
2977
  * Executes an effect for each element in the array, collecting results.
3039
2978
  *
@@ -3044,16 +2983,16 @@ declare const IO: (<A extends Type>(f: () => A | Promise<A>) => IO<never, unknow
3044
2983
  * ).run() // [2, 4, 6]
3045
2984
  * ```
3046
2985
  */
3047
- 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[]>;
2986
+ forEach: <R extends Type, E extends Type, A extends Type, B extends Type>(items: readonly A[], f: (a: A) => IO<R, E, B>) => IO<R, E, readonly B[]>;
3048
2987
  /**
3049
2988
  * Executes effects for each element in parallel (limited concurrency coming later).
3050
2989
  * Alias for forEach.
3051
2990
  */
3052
- 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[]>;
2991
+ forEachPar: <R extends Type, E extends Type, A extends Type, B extends Type>(items: readonly A[], f: (a: A) => IO<R, E, B>) => IO<R, E, readonly B[]>;
3053
2992
  /**
3054
2993
  * Creates a timeout effect that fails with TimeoutError.
3055
2994
  */
3056
- 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>;
2995
+ timeout: <R extends Type, E extends Type, A extends Type>(effect: IO<R, E, A>, ms: number) => IO<R, E | TimeoutError, A>;
3057
2996
  /**
3058
2997
  * Creates an IO from a generator function.
3059
2998
  * This enables do-notation style programming.
@@ -3094,7 +3033,7 @@ type Task<E extends Type, A extends Type> = IO<never, E, A>;
3094
3033
  /**
3095
3034
  * An IO with no error
3096
3035
  */
3097
- type RIO<R$1 extends Type, A extends Type> = IO<R$1, never, A>;
3036
+ type RIO<R extends Type, A extends Type> = IO<R, never, A>;
3098
3037
  //#endregion
3099
3038
  //#region src/io/TestClock.d.ts
3100
3039
  /**
@@ -3186,11 +3125,11 @@ declare const TestClock: {
3186
3125
  /**
3187
3126
  * TestContext provides a complete test environment with mocked services.
3188
3127
  */
3189
- interface TestContext<R$1 extends Type> {
3128
+ interface TestContext<R extends Type> {
3190
3129
  /**
3191
3130
  * The context containing test services
3192
3131
  */
3193
- readonly context: ReturnType<typeof Context.empty<R$1>>;
3132
+ readonly context: ReturnType<typeof Context.empty<R>>;
3194
3133
  /**
3195
3134
  * The TestClock for controlling time
3196
3135
  */
@@ -3198,11 +3137,11 @@ interface TestContext<R$1 extends Type> {
3198
3137
  /**
3199
3138
  * Adds a service to the test context
3200
3139
  */
3201
- withService<S extends Type>(tag: Tag<S>, service: S): TestContext<R$1 & S>;
3140
+ withService<S extends Type>(tag: Tag<S>, service: S): TestContext<R & S>;
3202
3141
  /**
3203
3142
  * Provides the test context to an IO effect and runs it
3204
3143
  */
3205
- run<E extends Type, A extends Type>(effect: IO<R$1, E, A>): Promise<A>;
3144
+ run<E extends Type, A extends Type>(effect: IO<R, E, A>): Promise<A>;
3206
3145
  }
3207
3146
  /**
3208
3147
  * Creates a TestContext for testing IO effects with mocked services.
@@ -3220,7 +3159,7 @@ declare const TestContext: {
3220
3159
  /**
3221
3160
  * Creates a new empty TestContext
3222
3161
  */
3223
- make: <R$1 extends Type = never>() => TestContext<R$1>;
3162
+ make: <R extends Type = never>() => TestContext<R>;
3224
3163
  /**
3225
3164
  * Creates a TestContext with a TestClock already provided
3226
3165
  */
@@ -3378,9 +3317,9 @@ interface Lazy<T extends Type> extends FunctypeBase<T, "Lazy">, Extractable<T>,
3378
3317
  * @param patterns - Object with handler for Lazy pattern
3379
3318
  * @returns The result of the matched handler
3380
3319
  */
3381
- match<R$1>(patterns: {
3382
- Lazy: (value: T) => R$1;
3383
- }): R$1;
3320
+ match<R>(patterns: {
3321
+ Lazy: (value: T) => R;
3322
+ }): R;
3384
3323
  /**
3385
3324
  * Creates a string representation of the Lazy
3386
3325
  * @returns String representation showing evaluation status
@@ -3493,72 +3432,6 @@ interface Traversable<A extends Type> extends AsyncMonad<A> {
3493
3432
  reduceRight(f: (b: A, a: A) => A): A;
3494
3433
  }
3495
3434
  //#endregion
3496
- //#region src/map/Map.d.ts
3497
- /**
3498
- * A traversable interface for map that excludes map and flatMap operations
3499
- */
3500
- type SafeTraversable<K$1, V> = Omit<Traversable<Tuple<[K$1, V]>>, "map" | "flatMap" | "flatMapAsync" | "ap">;
3501
- interface Map$1<K$1, V> extends SafeTraversable<K$1, V>, Collection<Tuple<[K$1, V]>>, Typeable<"Map">, Serializable<[K$1, V][]>, Pipe<[K$1, V][]>, Foldable<Tuple<[K$1, V]>>, Iterable<[K$1, V]> {
3502
- readonly _tag: "Map";
3503
- add(item: Tuple<[K$1, V]>): Map$1<K$1, V>;
3504
- remove(value: K$1): Map$1<K$1, V>;
3505
- map<U>(f: (value: V) => U): Map$1<K$1, U>;
3506
- ap<U>(ff: Map$1<K$1, (value: V) => U>): Map$1<K$1, U>;
3507
- flatMap<K2, V2>(f: (entry: Tuple<[K$1, V]>) => Iterable<[K2, V2]>): Map$1<K2, V2>;
3508
- flatMapAsync<U>(f: (value: V) => PromiseLike<Map$1<K$1, U>>): PromiseLike<Map$1<K$1, U>>;
3509
- get(key: K$1): Option<V>;
3510
- getOrElse(key: K$1, defaultValue: V): V;
3511
- orElse(key: K$1, alternative: Option<V>): Option<V>;
3512
- fold<U extends Type>(onEmpty: () => U, onValue: (value: Tuple<[K$1, V]>) => U): U;
3513
- foldLeft<B>(z: B): (op: (b: B, a: Tuple<[K$1, V]>) => B) => B;
3514
- foldRight<B>(z: B): (op: (a: Tuple<[K$1, V]>, b: B) => B) => B;
3515
- /**
3516
- * Pattern matches over the Map, applying a handler function based on whether it's empty
3517
- * @param patterns - Object with handler functions for Empty and NonEmpty variants
3518
- * @returns The result of applying the matching handler function
3519
- */
3520
- match<R$1>(patterns: {
3521
- Empty: () => R$1;
3522
- NonEmpty: (entries: Array<Tuple<[K$1, V]>>) => R$1;
3523
- }): R$1;
3524
- toValue(): {
3525
- _tag: "Map";
3526
- value: [K$1, V][];
3527
- };
3528
- }
3529
- declare const Map$1: (<K$1, V>(entries?: readonly (readonly [K$1, V])[] | IterableIterator<[K$1, V]> | null) => Map$1<K$1, V>) & {
3530
- /**
3531
- * Creates an empty Map
3532
- * Returns a singleton instance for efficiency
3533
- * @returns An empty Map instance
3534
- */
3535
- empty: <K$1, V>() => Map$1<K$1, V>;
3536
- /**
3537
- * Creates a Map from variadic key-value pair arguments
3538
- * @param entries - Key-value pairs to create map from
3539
- * @returns A Map containing the entries
3540
- */
3541
- of: <K$1, V>(...entries: [K$1, V][]) => Map$1<K$1, V>;
3542
- /**
3543
- * Creates a Map from JSON string
3544
- * @param json - The JSON string
3545
- * @returns Map instance
3546
- */
3547
- fromJSON: <K$1, V>(json: string) => Map$1<K$1, V>;
3548
- /**
3549
- * Creates a Map from YAML string
3550
- * @param yaml - The YAML string
3551
- * @returns Map instance
3552
- */
3553
- fromYAML: <K$1, V>(yaml: string) => Map$1<K$1, V>;
3554
- /**
3555
- * Creates a Map from binary string
3556
- * @param binary - The binary string
3557
- * @returns Map instance
3558
- */
3559
- fromBinary: <K$1, V>(binary: string) => Map$1<K$1, V>;
3560
- };
3561
- //#endregion
3562
3435
  //#region src/map/shim.d.ts
3563
3436
  /**
3564
3437
  * Type alias for the native JavaScript Map
@@ -3566,7 +3439,7 @@ declare const Map$1: (<K$1, V>(entries?: readonly (readonly [K$1, V])[] | Iterab
3566
3439
  * @module Map
3567
3440
  * @category Collections
3568
3441
  */
3569
- type ESMapType<K$1, V> = Map<K$1, V>;
3442
+ type ESMapType<K, V> = Map<K, V>;
3570
3443
  /**
3571
3444
  * Reference to the native JavaScript Map
3572
3445
  * @module Map
@@ -3591,7 +3464,7 @@ interface Matchable<A, Tags extends string = string> {
3591
3464
  * @param patterns - An object containing handler functions for each variant
3592
3465
  * @returns The result of applying the matching handler function
3593
3466
  */
3594
- match<R$1>(patterns: Record<Tags, (value: A) => R$1>): R$1;
3467
+ match<R>(patterns: Record<Tags, (value: A) => R>): R;
3595
3468
  }
3596
3469
  /**
3597
3470
  * Utility functions for working with Matchable data structures
@@ -3603,7 +3476,7 @@ declare const MatchableUtils: {
3603
3476
  * @param handler - The default handler function to apply
3604
3477
  * @returns A function that always applies the default handler
3605
3478
  */
3606
- default: <A, R$1>(handler: (value: A) => R$1) => (value: A) => R$1;
3479
+ default: <A, R>(handler: (value: A) => R) => (value: A) => R;
3607
3480
  /**
3608
3481
  * Helper function to create a match pattern that guards based on a predicate
3609
3482
  *
@@ -3611,7 +3484,7 @@ declare const MatchableUtils: {
3611
3484
  * @param handler - The handler function to apply if the predicate passes
3612
3485
  * @returns A function that applies the handler only if the predicate passes
3613
3486
  */
3614
- when: <A, R$1>(predicate: (value: A) => boolean, handler: (value: A) => R$1) => (value: A) => R$1 | undefined;
3487
+ when: <A, R>(predicate: (value: A) => boolean, handler: (value: A) => R) => (value: A) => R | undefined;
3615
3488
  };
3616
3489
  //#endregion
3617
3490
  //#region src/ref/Ref.d.ts
@@ -3739,61 +3612,12 @@ declare const createSerializationCompanion: <T>(reconstructor: (parsed: {
3739
3612
  fromBinary: (binary: string) => T;
3740
3613
  };
3741
3614
  //#endregion
3742
- //#region src/set/Set.d.ts
3743
- interface Set<A> extends FunctypeCollection<A, "Set">, Collection<A> {
3744
- add: (value: A) => Set<A>;
3745
- remove: (value: A) => Set<A>;
3746
- contains: (value: A) => boolean;
3747
- has: (value: A) => boolean;
3748
- map: <B>(f: (a: A) => B) => Set<B>;
3749
- flatMap: <B>(f: (a: A) => Iterable<B>) => Set<B>;
3750
- filter: (p: (a: A) => boolean) => Set<A>;
3751
- filterNot: (p: (a: A) => boolean) => Set<A>;
3752
- fold: <U extends Type>(onEmpty: () => U, onValue: (value: A) => U) => U;
3753
- toList: () => List<A>;
3754
- toSet: () => Set<A>;
3755
- toArray: <B = A>() => B[];
3756
- toString: () => string;
3757
- }
3758
- declare const Set: (<A>(iterable?: Iterable<A>) => Set<A>) & {
3759
- /**
3760
- * Creates an empty Set
3761
- * Returns a singleton instance for efficiency
3762
- * @returns An empty Set instance
3763
- */
3764
- empty: <A extends Type>() => Set<A>;
3765
- /**
3766
- * Creates a Set from variadic arguments
3767
- * @param values - Values to create set from
3768
- * @returns A Set containing the unique values
3769
- */
3770
- of: <A extends Type>(...values: A[]) => Set<A>;
3771
- /**
3772
- * Creates a Set from JSON string
3773
- * @param json - The JSON string
3774
- * @returns Set instance
3775
- */
3776
- fromJSON: <A>(json: string) => Set<A>;
3777
- /**
3778
- * Creates a Set from YAML string
3779
- * @param yaml - The YAML string
3780
- * @returns Set instance
3781
- */
3782
- fromYAML: <A>(yaml: string) => Set<A>;
3783
- /**
3784
- * Creates a Set from binary string
3785
- * @param binary - The binary string
3786
- * @returns Set instance
3787
- */
3788
- fromBinary: <A>(binary: string) => Set<A>;
3789
- };
3790
- //#endregion
3791
3615
  //#region src/valuable/Valuable.d.ts
3792
3616
  /**
3793
3617
  * Parameters for creating a Valuable instance
3794
3618
  */
3795
- type ValuableParams<Tag$1 extends string, T, V> = {
3796
- _tag: Tag$1;
3619
+ type ValuableParams<Tag extends string, T, V> = {
3620
+ _tag: Tag;
3797
3621
  impl: T;
3798
3622
  value: V;
3799
3623
  };
@@ -3803,16 +3627,16 @@ type ValuableParams<Tag$1 extends string, T, V> = {
3803
3627
  * @module Valuable
3804
3628
  * @category Utilities
3805
3629
  */
3806
- declare function Valuable<Tag$1 extends string, V, T = object>(params: ValuableParams<Tag$1, T, V>): T & {
3630
+ declare function Valuable<Tag extends string, V, T = object>(params: ValuableParams<Tag, T, V>): T & {
3807
3631
  toValue: () => {
3808
- _tag: Tag$1;
3632
+ _tag: Tag;
3809
3633
  value: V;
3810
3634
  };
3811
- _tag: Tag$1;
3635
+ _tag: Tag;
3812
3636
  };
3813
- type Valuable<Tag$1 extends string, V, T = object> = Typeable<Tag$1, T> & {
3637
+ type Valuable<Tag extends string, V, T = object> = Typeable<Tag, T> & {
3814
3638
  toValue: () => {
3815
- _tag: Tag$1;
3639
+ _tag: Tag;
3816
3640
  value: V;
3817
3641
  };
3818
3642
  };
@@ -3883,10 +3707,10 @@ type Stack<A extends Type> = {
3883
3707
  * @param patterns - Object with handler functions for Empty and NonEmpty variants
3884
3708
  * @returns The result of applying the matching handler function
3885
3709
  */
3886
- match<R$1>(patterns: {
3887
- Empty: () => R$1;
3888
- NonEmpty: (values: A[]) => R$1;
3889
- }): R$1;
3710
+ match<R>(patterns: {
3711
+ Empty: () => R;
3712
+ NonEmpty: (values: A[]) => R;
3713
+ }): R;
3890
3714
  } & Traversable<A> & Valuable<"Stack", A[]> & Serializable<A> & Pipe<A[]> & Foldable<A> & Matchable<A[], "Empty" | "NonEmpty">;
3891
3715
  declare const Stack: (<A extends Type>(values?: A[]) => Stack<A>) & {
3892
3716
  /**
@@ -3920,304 +3744,6 @@ declare const Stack: (<A extends Type>(values?: A[]) => Stack<A>) & {
3920
3744
  fromBinary: <A>(binary: string) => Stack<A>;
3921
3745
  };
3922
3746
  //#endregion
3923
- //#region src/option/Option.d.ts
3924
- /**
3925
- * Option type module
3926
- * @module Option
3927
- * @category Core
3928
- */
3929
- /**
3930
- * The Option type represents a value that may or may not exist.
3931
- * It's used to handle potentially null or undefined values in a type-safe way.
3932
- * @typeParam T - The type of the value contained in the Option
3933
- */
3934
- interface Option<T extends Type> extends Functype<T, "Some" | "None">, Promisable<T>, Doable<T>, Reshapeable<T> {
3935
- /** The contained value (undefined for None) */
3936
- readonly value: T | undefined;
3937
- /** Whether this Option contains no value */
3938
- isEmpty: boolean;
3939
- /**
3940
- * Returns true if this Option is a Some (contains a value)
3941
- * @returns true if this Option contains a value, false otherwise
3942
- */
3943
- isSome(): this is Option<T> & {
3944
- value: T;
3945
- isEmpty: false;
3946
- };
3947
- /**
3948
- * Returns true if this Option is a None (contains no value)
3949
- * @returns true if this Option is empty, false otherwise
3950
- */
3951
- isNone(): this is Option<T> & {
3952
- value: undefined;
3953
- isEmpty: true;
3954
- };
3955
- /**
3956
- * Returns the contained value or a default value if None
3957
- * @param defaultValue - The value to return if this Option is None
3958
- * @returns The contained value or defaultValue
3959
- */
3960
- orElse(defaultValue: T): T;
3961
- /**
3962
- * Returns the contained value or throws an error if None
3963
- * @param error - Optional custom error to throw. If not provided, throws a default error
3964
- * @returns The contained value
3965
- * @throws The specified error or a default error if the Option is None
3966
- */
3967
- orThrow(error?: Error): T;
3968
- /**
3969
- * Returns this Option if it contains a value, otherwise returns the alternative container
3970
- * @param alternative - The alternative Option to return if this is None
3971
- * @returns This Option or the alternative
3972
- */
3973
- or(alternative: Option<T>): Option<T>;
3974
- /**
3975
- * Returns the contained value or null if None
3976
- * @returns The contained value or null
3977
- */
3978
- orNull(): T | null;
3979
- /**
3980
- * Returns the contained value or undefined if None
3981
- * @returns The contained value or undefined
3982
- */
3983
- orUndefined(): T | undefined;
3984
- /**
3985
- * Maps the value inside the Option using the provided function
3986
- * @param f - The mapping function
3987
- * @returns A new Option containing the mapped value, or None if this Option is None
3988
- */
3989
- map<U extends Type>(f: (value: T) => U): Option<U>;
3990
- /**
3991
- * Applies a wrapped function to a wrapped value (Applicative pattern)
3992
- * @param ff - An Option containing a function from T to U
3993
- * @returns A new Option containing the result of applying the function
3994
- */
3995
- ap<U extends Type>(ff: Option<(value: T) => U>): Option<U>;
3996
- /**
3997
- * Returns this Option if it contains a value that satisfies the predicate, otherwise returns None
3998
- * @param predicate - The predicate function to test the value
3999
- * @returns This Option or None
4000
- */
4001
- filter(predicate: (value: T) => boolean): Option<T>;
4002
- /**
4003
- * Maps the value using a function that returns an Option
4004
- * @param f - The mapping function returning an Option
4005
- * @returns The result of applying f to the contained value, or None if this Option is None
4006
- */
4007
- flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
4008
- /**
4009
- * Maps the value using an async function that returns an Option
4010
- * @param f - The async mapping function returning an Option
4011
- * @returns Promise of the result of applying f to the contained value, or None if this Option is None
4012
- */
4013
- flatMapAsync<U extends Type>(f: (value: T) => Promise<Option<U>>): Promise<Option<U>>;
4014
- /**
4015
- * Applies a binary operator to a start value and the contained value
4016
- * @param f - The binary operator
4017
- * @returns The result of the reduction
4018
- */
4019
- reduce<U>(f: (acc: U, value: T) => U): U;
4020
- /**
4021
- * Applies a binary operator to the contained value and a start value
4022
- * @param f - The binary operator
4023
- * @returns The result of the reduction
4024
- */
4025
- reduceRight<U>(f: (acc: U, value: T) => U): U;
4026
- /**
4027
- * Pattern matches over the Option, applying onNone if None and onSome if Some
4028
- * @param onNone - Function to apply if the Option is None
4029
- * @param onSome - Function to apply if the Option has a value
4030
- * @returns The result of applying the appropriate function
4031
- */
4032
- fold<U>(onNone: () => U, onSome: (value: T) => U): U;
4033
- /**
4034
- * Left-associative fold using the provided zero value and operation
4035
- * @param z - Zero/identity value
4036
- * @returns A function that takes an operation to apply
4037
- */
4038
- foldLeft<B>(z: B): (op: (b: B, a: T) => B) => B;
4039
- /**
4040
- * Right-associative fold using the provided zero value and operation
4041
- * @param z - Zero/identity value
4042
- * @returns A function that takes an operation to apply
4043
- */
4044
- foldRight<B>(z: B): (op: (a: T, b: B) => B) => B;
4045
- /**
4046
- * Converts this Option to a List
4047
- * @returns A List containing the value if Some, or empty List if None
4048
- */
4049
- toList(): List<T>;
4050
- /**
4051
- * Checks if this Option contains the specified value
4052
- * @param value - The value to check for
4053
- * @returns true if this Option contains the value, false otherwise
4054
- */
4055
- contains(value: T): boolean;
4056
- /** The number of elements in this Option (0 or 1) */
4057
- size: number;
4058
- /**
4059
- * Converts this Option to an Either
4060
- * @param left - The value to use for Left if this Option is None
4061
- * @returns Either.Right with the contained value if Some, or Either.Left with left if None
4062
- */
4063
- toEither<E>(left: E): Either<E, T>;
4064
- /**
4065
- * Returns a string representation of this Option
4066
- * @returns A string representation
4067
- */
4068
- toString(): string;
4069
- /**
4070
- * Returns a simple object representation of this Option
4071
- * @returns An object with _tag and value properties
4072
- */
4073
- toValue(): {
4074
- _tag: "Some" | "None";
4075
- value: T;
4076
- };
4077
- /**
4078
- * Pattern matches over the Option, applying a handler function based on the variant
4079
- * @param patterns - Object with handler functions for Some and None variants
4080
- * @returns The result of applying the matching handler function
4081
- */
4082
- match<R$1>(patterns: {
4083
- Some: (value: T) => R$1;
4084
- None: () => R$1;
4085
- }): R$1;
4086
- }
4087
- /**
4088
- * Creates a Some variant of Option containing a value.
4089
- * @param value - The value to wrap in Some
4090
- * @returns A new Some instance containing the value
4091
- * @typeParam T - The type of the value
4092
- */
4093
- declare const Some: <T extends Type>(value: T) => Option<T>;
4094
- /**
4095
- * Creates a None variant of Option representing absence of a value.
4096
- * @returns A new None instance
4097
- * @typeParam T - The type that would be contained if this was a Some
4098
- */
4099
- declare const None: <T extends Type>() => Option<T>;
4100
- /**
4101
- * Safely wraps a value that might be null or undefined in an Option.
4102
- * Creates Some if the value is defined, None otherwise.
4103
- * @param value - The value to wrap (might be null/undefined)
4104
- * @returns Some(value) if value is defined, None otherwise
4105
- * @typeParam T - The type of the value
4106
- */
4107
- declare const OptionConstructor: <T extends Type>(value: T | null | undefined) => Option<T>;
4108
- declare const Option: (<T extends Type>(value: T | null | undefined) => Option<T>) & {
4109
- /**
4110
- * Creates an Option from any value. Alias for Option function.
4111
- * @param value - The value to wrap
4112
- * @returns Some(value) if value is defined, None otherwise
4113
- * @typeParam T - The type of the value
4114
- */
4115
- from: <T>(value: T) => Option<T>;
4116
- /**
4117
- * Returns a None instance. Alias for None function.
4118
- * @returns A None instance
4119
- * @typeParam T - The type that would be contained if this was a Some
4120
- */
4121
- none: <T>() => Option<T>;
4122
- /**
4123
- * Type guard to check if an Option is Some
4124
- * @param option - The Option to check
4125
- * @returns True if Option is Some
4126
- */
4127
- isSome: <T>(option: Option<T>) => option is Option<T> & {
4128
- value: T;
4129
- isEmpty: false;
4130
- };
4131
- /**
4132
- * Type guard to check if an Option is None
4133
- * @param option - The Option to check
4134
- * @returns True if Option is None
4135
- */
4136
- isNone: <T>(option: Option<T>) => option is Option<T> & {
4137
- value: undefined;
4138
- isEmpty: true;
4139
- };
4140
- /**
4141
- * Creates an Option from JSON string
4142
- * @param json - The JSON string
4143
- * @returns Option instance
4144
- */
4145
- fromJSON: <T>(json: string) => Option<T>;
4146
- /**
4147
- * Creates an Option from YAML string
4148
- * @param yaml - The YAML string
4149
- * @returns Option instance
4150
- */
4151
- fromYAML: <T>(yaml: string) => Option<T>;
4152
- /**
4153
- * Creates an Option from binary string
4154
- * @param binary - The binary string
4155
- * @returns Option instance
4156
- */
4157
- fromBinary: <T>(binary: string) => Option<T>;
4158
- };
4159
- //#endregion
4160
- //#region src/list/List.d.ts
4161
- interface List<A> extends FunctypeCollection<A, "List">, Doable<A>, Reshapeable<A> {
4162
- readonly length: number;
4163
- readonly [Symbol.iterator]: () => Iterator<A>;
4164
- map: <B>(f: (a: A) => B) => List<B>;
4165
- ap: <B>(ff: List<(value: A) => B>) => List<B>;
4166
- flatMap: <B>(f: (a: A) => Iterable<B>) => List<B>;
4167
- flatMapAsync: <B>(f: (a: A) => PromiseLike<Iterable<B>>) => PromiseLike<List<B>>;
4168
- filter<S extends A>(predicate: (a: A) => a is S): List<S>;
4169
- filter(predicate: (a: A) => unknown): List<A>;
4170
- filterNot: (p: (a: A) => boolean) => List<A>;
4171
- /** @internal */
4172
- filterType: <T extends Typeable<string, unknown>>(tag: string) => List<T & A>;
4173
- remove: (value: A) => List<A>;
4174
- removeAt: (index: number) => List<A>;
4175
- add: (item: A) => List<A>;
4176
- get: (index: number) => Option<A>;
4177
- concat: (other: List<A>) => List<A>;
4178
- /**
4179
- * Pattern matches over the List, applying a handler function based on whether it's empty
4180
- * @param patterns - Object with handler functions for Empty and NonEmpty variants
4181
- * @returns The result of applying the matching handler function
4182
- */
4183
- match<R$1>(patterns: {
4184
- Empty: () => R$1;
4185
- NonEmpty: (values: A[]) => R$1;
4186
- }): R$1;
4187
- }
4188
- declare const List: (<A>(values?: Iterable<A>) => List<A>) & {
4189
- /**
4190
- * Creates an empty List
4191
- * Returns a singleton instance for efficiency
4192
- * @returns An empty List instance
4193
- */
4194
- empty: <A extends Type>() => List<A>;
4195
- /**
4196
- * Creates a List from variadic arguments
4197
- * @param values - Values to create list from
4198
- * @returns A List containing the values
4199
- */
4200
- of: <A extends Type>(...values: A[]) => List<A>;
4201
- /**
4202
- * Creates a List from JSON string
4203
- * @param json - The JSON string
4204
- * @returns List instance
4205
- */
4206
- fromJSON: <A>(json: string) => List<A>;
4207
- /**
4208
- * Creates a List from YAML string
4209
- * @param yaml - The YAML string
4210
- * @returns List instance
4211
- */
4212
- fromYAML: <A>(yaml: string) => List<A>;
4213
- /**
4214
- * Creates a List from binary string
4215
- * @param binary - The binary string
4216
- * @returns List instance
4217
- */
4218
- fromBinary: <A>(binary: string) => List<A>;
4219
- };
4220
- //#endregion
4221
3747
  //#region src/collections/index.d.ts
4222
3748
  /**
4223
3749
  * Represents a collection with conversion capabilities
@@ -4247,8 +3773,8 @@ interface Collection<A> {
4247
3773
  * }
4248
3774
  * ```
4249
3775
  */
4250
- interface FunctypeBase<A, Tag$1 extends string = string> extends AsyncMonad<A>, Traversable<A>, Serializable<A>, Foldable<A>, Typeable<Tag$1>, ContainerOps<A> {
4251
- readonly _tag: Tag$1;
3776
+ interface FunctypeBase<A, Tag extends string = string> extends AsyncMonad<A>, Traversable<A>, Serializable<A>, Foldable<A>, Typeable<Tag>, ContainerOps<A> {
3777
+ readonly _tag: Tag;
4252
3778
  }
4253
3779
  /**
4254
3780
  * Interface for single-value containers like Option, Either, Try.
@@ -4257,9 +3783,9 @@ interface FunctypeBase<A, Tag$1 extends string = string> extends AsyncMonad<A>,
4257
3783
  * @typeParam A - The type of value contained
4258
3784
  * @typeParam Tag - The type tag for pattern matching
4259
3785
  */
4260
- interface Functype<A, Tag$1 extends string = string> extends FunctypeBase<A, Tag$1>, Extractable<A>, Pipe<A>, Matchable<A, Tag$1> {
3786
+ interface Functype<A, Tag extends string = string> extends FunctypeBase<A, Tag>, Extractable<A>, Pipe<A>, Matchable<A, Tag> {
4261
3787
  toValue(): {
4262
- _tag: Tag$1;
3788
+ _tag: Tag;
4263
3789
  value: A;
4264
3790
  };
4265
3791
  }
@@ -4270,372 +3796,13 @@ interface Functype<A, Tag$1 extends string = string> extends FunctypeBase<A, Tag
4270
3796
  * @typeParam A - The element type of the collection
4271
3797
  * @typeParam Tag - The type tag for pattern matching
4272
3798
  */
4273
- 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>> {
3799
+ 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>> {
4274
3800
  toValue(): {
4275
- _tag: Tag$1;
3801
+ _tag: Tag;
4276
3802
  value: A[];
4277
3803
  };
4278
- flatMap<B extends Type>(f: (value: A) => Iterable<B>): FunctypeCollection<B, Tag$1>;
4279
- flatMapAsync<B extends Type>(f: (value: A) => PromiseLike<Iterable<B>>): PromiseLike<FunctypeCollection<B, Tag$1>>;
4280
- }
4281
- //#endregion
4282
- //#region src/either/Either.d.ts
4283
- /**
4284
- * Either type module
4285
- * @module Either
4286
- * @category Core
4287
- */
4288
- interface Either<L extends Type, R$1 extends Type> extends FunctypeBase<R$1, "Left" | "Right">, Promisable<R$1>, Doable<R$1>, Reshapeable<R$1>, Extractable<R$1> {
4289
- readonly _tag: "Left" | "Right";
4290
- value: L | R$1;
4291
- isLeft(): this is Either<L, R$1> & {
4292
- readonly _tag: "Left";
4293
- value: L;
4294
- };
4295
- isRight(): this is Either<L, R$1> & {
4296
- readonly _tag: "Right";
4297
- value: R$1;
4298
- };
4299
- orElse: (defaultValue: R$1) => R$1;
4300
- orThrow: (error?: Error) => R$1;
4301
- or(alternative: Either<L, R$1>): Either<L, R$1>;
4302
- orNull: () => R$1 | null;
4303
- orUndefined: () => R$1 | undefined;
4304
- readonly map: <U extends Type>(f: (value: R$1) => U) => Either<L, U>;
4305
- ap: <U extends Type>(ff: Either<L, (value: R$1) => U>) => Either<L, U>;
4306
- merge: <L1 extends Type, R1 extends Type>(other: Either<L1, R1>) => Either<L | L1, [R$1, R1]>;
4307
- mapAsync: <U extends Type>(f: (value: R$1) => Promise<U>) => Promise<Either<L, U>>;
4308
- flatMap: <U extends Type>(f: (value: R$1) => Either<L, U>) => Either<L, U>;
4309
- flatMapAsync: <U extends Type>(f: (value: R$1) => Promise<Either<L, U>>) => Promise<Either<L, U>>;
4310
- toOption: () => Option<R$1>;
4311
- toList: () => List<R$1>;
4312
- toString: () => string;
4313
- [Symbol.iterator]: () => Iterator<R$1>;
4314
- yield: () => Generator<R$1, void, unknown>;
4315
- traverse: <U extends Type>(f: (value: R$1) => Either<L, U>) => Either<L, U[]>;
4316
- lazyMap: <U extends Type>(f: (value: R$1) => U) => Generator<Either<L, U>, void, unknown>;
4317
- tap: (f: (value: R$1) => void) => Either<L, R$1>;
4318
- tapLeft: (f: (value: L) => void) => Either<L, R$1>;
4319
- mapLeft: <L2 extends Type>(f: (value: L) => L2) => Either<L2, R$1>;
4320
- bimap: <L2 extends Type, R2 extends Type>(fl: (value: L) => L2, fr: (value: R$1) => R2) => Either<L2, R2>;
4321
- fold: <T extends Type>(onLeft: (value: L) => T, onRight: (value: R$1) => T) => T;
4322
- swap: () => Either<R$1, L>;
4323
- /**
4324
- * Pipes the value through the provided function based on whether this is a Left or Right
4325
- * @param onLeft - The function to apply if this is a Left
4326
- * @param onRight - The function to apply if this is a Right
4327
- * @returns The result of applying the appropriate function
4328
- */
4329
- pipeEither<U extends Type>(onLeft: (value: L) => U, onRight: (value: R$1) => U): U;
4330
- /**
4331
- * Pipes the Either value through the provided function
4332
- * @param f - The function to apply to the value (Left or Right)
4333
- * @returns The result of applying the function to the value
4334
- */
4335
- pipe<U extends Type>(f: (value: L | R$1) => U): U;
4336
- /**
4337
- * Pattern matches over the Either, applying a handler function based on the variant
4338
- * @param patterns - Object with handler functions for Left and Right variants
4339
- * @returns The result of applying the matching handler function
4340
- */
4341
- match<T>(patterns: {
4342
- Left: (value: L) => T;
4343
- Right: (value: R$1) => T;
4344
- }): T;
4345
- /**
4346
- * Returns the value and tag for inspection
4347
- */
4348
- toValue(): {
4349
- _tag: "Left" | "Right";
4350
- value: L | R$1;
4351
- };
4352
- /**
4353
- * Custom JSON serialization that excludes getter properties
4354
- */
4355
- toJSON(): {
4356
- _tag: "Left" | "Right";
4357
- value: L | R$1;
4358
- };
4359
- }
4360
- type TestEither<L extends Type, R$1 extends Type> = Either<L, R$1> & AsyncMonad<R$1>;
4361
- declare const Right: <L extends Type, R$1 extends Type>(value: R$1) => Either<L, R$1>;
4362
- declare const Left: <L extends Type, R$1 extends Type>(value: L) => Either<L, R$1>;
4363
- declare const isRight: <L extends Type, R$1 extends Type>(either: Either<L, R$1>) => either is Either<L, R$1> & {
4364
- value: R$1;
4365
- };
4366
- declare const isLeft: <L extends Type, R$1 extends Type>(either: Either<L, R$1>) => either is Either<L, R$1> & {
4367
- value: L;
4368
- };
4369
- declare const tryCatch: <L extends Type, R$1 extends Type>(f: () => R$1, onError: (error: unknown) => L) => Either<L, R$1>;
4370
- declare const TypeCheckRight: <L extends Type, R$1 extends Type>(value: R$1) => TestEither<L, R$1>;
4371
- declare const TypeCheckLeft: <L extends Type, R$1 extends Type>(value: L) => TestEither<L, R$1>;
4372
- declare const tryCatchAsync: <L extends Type, R$1 extends Type>(f: () => Promise<R$1>, onError: (error: unknown) => L) => Promise<Either<L, R$1>>;
4373
- declare const Either: (<L extends Type, R$1 extends Type>(value: R$1 | L, isRight: boolean) => Either<L, R$1>) & {
4374
- /**
4375
- * Creates a Left instance
4376
- * @param value - The left value
4377
- * @returns Left Either
4378
- */
4379
- left: <L extends Type, R$1 extends Type>(value: L) => Either<L, R$1>;
4380
- /**
4381
- * Creates a Right instance
4382
- * @param value - The right value
4383
- * @returns Right Either
4384
- */
4385
- right: <L extends Type, R$1 extends Type>(value: R$1) => Either<L, R$1>;
4386
- /**
4387
- * Type guard to check if an Either is Right
4388
- * @param either - The Either to check
4389
- * @returns True if Either is Right
4390
- */
4391
- isRight: <L extends Type, R$1 extends Type>(either: Either<L, R$1>) => either is Either<L, R$1> & {
4392
- value: R$1;
4393
- };
4394
- /**
4395
- * Type guard to check if an Either is Left
4396
- * @param either - The Either to check
4397
- * @returns True if Either is Left
4398
- */
4399
- isLeft: <L extends Type, R$1 extends Type>(either: Either<L, R$1>) => either is Either<L, R$1> & {
4400
- value: L;
4401
- };
4402
- /**
4403
- * Combines an array of Eithers into a single Either containing an array
4404
- * @param eithers - Array of Either values
4405
- * @returns Either with array of values or first Left encountered
4406
- */
4407
- sequence: <L extends Type, R$1 extends Type>(eithers: Either<L, R$1>[]) => Either<L, R$1[]>;
4408
- /**
4409
- * Maps an array through a function that returns Either, then sequences the results
4410
- * @param arr - Array of values
4411
- * @param f - Function that returns Either
4412
- * @returns Either with array of results or first Left encountered
4413
- */
4414
- traverse: <L extends Type, R$1 extends Type, U extends Type>(arr: R$1[], f: (value: R$1) => Either<L, U>) => Either<L, U[]>;
4415
- /**
4416
- * Creates an Either from a nullable value
4417
- * @param value - The value that might be null or undefined
4418
- * @param leftValue - The value to use for Left if value is null/undefined
4419
- * @returns Right if value is not null/undefined, Left otherwise
4420
- */
4421
- fromNullable: <L extends Type, R$1 extends Type>(value: R$1 | null | undefined, leftValue: L) => Either<L, R$1>;
4422
- /**
4423
- * Creates an Either based on a predicate
4424
- * @param value - The value to test
4425
- * @param predicate - The predicate function
4426
- * @param leftValue - The value to use for Left if predicate fails
4427
- * @returns Right if predicate passes, Left otherwise
4428
- */
4429
- fromPredicate: <L extends Type, R$1 extends Type>(value: R$1, predicate: (value: R$1) => boolean, leftValue: L) => Either<L, R$1>;
4430
- /**
4431
- * Applicative apply - applies a wrapped function to a wrapped value
4432
- * @param eitherF - Either containing a function
4433
- * @param eitherV - Either containing a value
4434
- * @returns Either with function applied to value
4435
- */
4436
- ap: <L extends Type, R$1 extends Type, U extends Type>(eitherF: Either<L, (value: R$1) => U>, eitherV: Either<L, R$1>) => Either<L, U>;
4437
- /**
4438
- * Creates an Either from a Promise
4439
- * @param promise - The Promise to convert
4440
- * @param onRejected - Function to convert rejection reason to Left value
4441
- * @returns Promise that resolves to Either
4442
- */
4443
- fromPromise: <L, R$1>(promise: Promise<R$1>, onRejected: (reason: unknown) => L) => Promise<Either<L, R$1>>;
4444
- /**
4445
- * Creates an Either from JSON string
4446
- * @param json - The JSON string
4447
- * @returns Either instance
4448
- */
4449
- fromJSON: <L extends Type, R$1 extends Type>(json: string) => Either<L, R$1>;
4450
- /**
4451
- * Creates an Either from YAML string
4452
- * @param yaml - The YAML string
4453
- * @returns Either instance
4454
- */
4455
- fromYAML: <L extends Type, R$1 extends Type>(yaml: string) => Either<L, R$1>;
4456
- /**
4457
- * Creates an Either from binary string
4458
- * @param binary - The binary string
4459
- * @returns Either instance
4460
- */
4461
- fromBinary: <L extends Type, R$1 extends Type>(binary: string) => Either<L, R$1>;
4462
- };
4463
- //#endregion
4464
- //#region src/do/index.d.ts
4465
- type OptionLike = {
4466
- _tag: "Some" | "None";
4467
- isSome(): boolean;
4468
- get(): unknown;
4469
- };
4470
- type EitherLike = {
4471
- _tag: "Left" | "Right";
4472
- isLeft(): boolean;
4473
- isRight(): boolean;
4474
- value: unknown;
4475
- };
4476
- type ListLike = {
4477
- _tag: "List";
4478
- toArray(): unknown[];
4479
- };
4480
- type TryLike = {
4481
- _tag: "Success" | "Failure";
4482
- isSuccess(): boolean;
4483
- get(): unknown;
4484
- };
4485
- /**
4486
- * Executes a generator-based monadic comprehension
4487
- * Returns the same monad type as the first yielded monad (Scala semantics)
4488
- *
4489
- * - Option comprehensions return Option (None on short-circuit)
4490
- * - Either comprehensions return Either (Left with error on short-circuit)
4491
- * - List comprehensions return List (empty or cartesian product)
4492
- * - Try comprehensions return Try (Failure with error on short-circuit)
4493
- *
4494
- * Type Inference Notes:
4495
- * - TypeScript infers the correct return type for homogeneous comprehensions
4496
- * - For mixed monad types, TypeScript returns a union type
4497
- * - Use DoTyped<T> or type assertions for mixed scenarios
4498
- *
4499
- * @example
4500
- * ```typescript
4501
- * // Option comprehension returns Option:
4502
- * const result = Do(function* () {
4503
- * const x = yield* $(Option(5));
4504
- * const y = yield* $(Option(10));
4505
- * return x + y;
4506
- * });
4507
- * // result: Option(15)
4508
- *
4509
- * // Either comprehension returns Either:
4510
- * const result = Do(function* () {
4511
- * const x = yield* $(Right(5));
4512
- * const y = yield* $(Left("error"));
4513
- * return x + y;
4514
- * });
4515
- * // result: Left("error") - error is preserved
4516
- *
4517
- * // List comprehension returns List with cartesian product:
4518
- * const result = Do(function* () {
4519
- * const x = yield* $(List([1, 2]));
4520
- * const y = yield* $(List([3, 4]));
4521
- * return x + y;
4522
- * });
4523
- * // result: List([4, 5, 5, 6])
4524
- *
4525
- * // Mixed types - use type assertion or DoTyped:
4526
- * const result = Do(function* () {
4527
- * const x = yield* $(Option(5));
4528
- * const y = yield* $(Right<string, number>(10));
4529
- * return x + y;
4530
- * }) as Option<number>;
4531
- * // result: Option(15)
4532
- * ```
4533
- *
4534
- * @param gen - Generator function that yields monads and returns a result
4535
- * @returns The same monad type as the first yield
4536
- */
4537
- declare function Do<T>(gen: () => Generator<OptionLike, T, unknown>): Option<T>;
4538
- declare function Do<L, R$1>(gen: () => Generator<EitherLike, R$1, unknown>): Either<L, R$1>;
4539
- declare function Do<T>(gen: () => Generator<ListLike, T, unknown>): List<T>;
4540
- declare function Do<T>(gen: () => Generator<TryLike, T, unknown>): Try<T>;
4541
- declare function Do<T>(gen: () => Generator<OptionLike | EitherLike | ListLike | TryLike, T, unknown>): Reshapeable<T>;
4542
- declare function Do<T>(gen: () => Generator<unknown, T, unknown>): unknown;
4543
- /**
4544
- * Executes an async generator-based monadic comprehension
4545
- * Returns the same monad type as the first yielded monad
4546
- *
4547
- * @example
4548
- * ```typescript
4549
- * const result = await DoAsync(async function* () {
4550
- * const user = yield* $(await fetchUser(id)); // Promise<Option<User>> → User
4551
- * const profile = yield* $(await getProfile(user)); // Promise<Either<Error, Profile>> → Profile
4552
- * return { user, profile };
4553
- * });
4554
- * // result type matches first yield
4555
- * ```
4556
- *
4557
- * @param gen - Async generator function that yields monads/promises and returns a result
4558
- * @returns Promise of the same monad type as first yield
4559
- */
4560
- declare function DoAsync<T>(gen: () => AsyncGenerator<OptionLike, T, unknown>): Promise<Option<T>>;
4561
- declare function DoAsync<L, R$1>(gen: () => AsyncGenerator<EitherLike, R$1, unknown>): Promise<Either<L, R$1>>;
4562
- declare function DoAsync<T>(gen: () => AsyncGenerator<ListLike, T, unknown>): Promise<List<T>>;
4563
- declare function DoAsync<T>(gen: () => AsyncGenerator<TryLike, T, unknown>): Promise<Try<T>>;
4564
- declare function DoAsync<T>(gen: () => AsyncGenerator<OptionLike | EitherLike | ListLike | TryLike, T, unknown>): Promise<Reshapeable<T>>;
4565
- declare function DoAsync<T>(gen: () => AsyncGenerator<unknown, T, unknown>): Promise<unknown>;
4566
- /**
4567
- * Helper function to check if a value implements the Doable interface
4568
- * @param value - Value to check
4569
- * @returns True if the value implements Doable
4570
- */
4571
- declare function isDoCapable<T>(value: unknown): value is Doable<T>;
4572
- /**
4573
- * Manually unwrap a monad using the Doable interface
4574
- * Useful for testing or when you need to unwrap outside of a Do-comprehension
4575
- *
4576
- * @param monad - Monad to unwrap
4577
- * @returns The unwrapped value
4578
- * @throws Error if the monad cannot be unwrapped
4579
- */
4580
- declare function unwrap<T>(monad: Doable<T>): T;
4581
- /**
4582
- * Type helper for Do-notation generators.
4583
- * Provides better type hints in IDEs.
4584
- *
4585
- * @example
4586
- * ```typescript
4587
- * const result = Do(function* (): DoGenerator<number> {
4588
- * const x = yield* $(List([1, 2])) // x is still unknown but return type is clear
4589
- * const y = yield* $(List([3, 4]))
4590
- * return x + y
4591
- * })
4592
- * ```
4593
- */
4594
- type DoGenerator<T, TYield = unknown> = Generator<TYield, T, unknown>;
4595
- /**
4596
- * Extracts values from monads in Do-notation with type inference.
4597
- * The '$' symbol is the universal extraction operator in functional programming.
4598
- *
4599
- * @example
4600
- * ```typescript
4601
- * const result = Do(function* () {
4602
- * const x = yield* $(Option(5)) // x: number
4603
- * const y = yield* $(List([1, 2, 3])) // y: number (for cartesian product)
4604
- * const name = yield* $(Right("Alice")) // name: string
4605
- * return `${name}: ${x + y}`
4606
- * })
4607
- * ```
4608
- *
4609
- * @param monad - Any monad that can be unwrapped (Option, Either, List, Try, etc.)
4610
- * @returns A generator that yields the monad and returns its extracted value
4611
- */
4612
- declare function $<T>(monad: Option<T>): Generator<Option<T>, T, T>;
4613
- declare function $<L, R$1>(monad: Either<L, R$1>): Generator<Either<L, R$1>, R$1, R$1>;
4614
- declare function $<T>(monad: List<T>): Generator<List<T>, T, T>;
4615
- declare function $<T>(monad: Try<T>): Generator<Try<T>, T, T>;
4616
- declare function $<T>(monad: Doable<T>): Generator<Doable<T>, T, T>;
4617
- declare function $<M>(monad: M): Generator<M, InferYieldType<M>, InferYieldType<M>>;
4618
- type InferYieldType<M> = M extends {
4619
- isSome(): boolean;
4620
- get(): infer T;
4621
- } ? T : M extends {
4622
- isRight(): boolean;
4623
- value: infer R;
4624
- } ? R : M extends {
4625
- toArray(): (infer T)[];
4626
- } ? T : M extends {
4627
- isSuccess(): boolean;
4628
- get(): infer T;
4629
- } ? T : M extends Doable<infer T> ? T : unknown;
4630
- declare const NoneError: (message?: string) => Error;
4631
- interface LeftErrorType<L> extends Error {
4632
- value: L;
4633
- }
4634
- declare const LeftError: <L>(value: L, message?: string) => LeftErrorType<L>;
4635
- declare const EmptyListError: (message?: string) => Error;
4636
- interface FailureErrorType extends Error {
4637
- cause: Error;
3804
+ flatMap<B extends Type>(f: (value: A) => Iterable<B>): FunctypeCollection<B, Tag>;
3805
+ flatMapAsync<B extends Type>(f: (value: A) => PromiseLike<Iterable<B>>): PromiseLike<FunctypeCollection<B, Tag>>;
4638
3806
  }
4639
- declare const FailureError: (cause: Error, message?: string) => FailureErrorType;
4640
3807
  //#endregion
4641
- export { TestClockTag as $, TaskFailure as $t, OptionConstructor as A, ValidatedBrand as An, ValidationRule as At, fromBinary as B, ContainerOps as Bn, TaskErrorInfo as Bt, Functype as C, NonEmptyString as Cn, OptionKind as Ct, List as D, PositiveNumber as Dn, FieldValidation as Dt, Collection as E, PositiveInteger as En, FoldableUtils as Et, Set as F, Applicative as Fn, TypedError as Ft, MatchableUtils as G, Doable as Gn, Async as Gt, fromYAML as H, Extractable as Hn, formatError as Ht, SerializationResult as I, AsyncMonad as In, TypedErrorContext as It, Map$1 as J, Err as Jt, ESMap as K, ParseError as Kn, CancellationToken as Kt, createCustomSerializer as L, Functor as Ln, ErrorChainElement as Lt, Stack as M, Try as Mn, ErrorCode as Mt, Valuable as N, TypeNames as Nn, ErrorMessage as Nt, None as O, UUID as On, FormValidation as Ot, ValuableParams as P, Promisable as Pn, ErrorStatus as Pt, TestClock as Q, Task$1 as Qt, createSerializationCompanion as R, Monad as Rn, ErrorFormatterOptions as Rt, tryCatchAsync as S, IntegerNumber as Sn, ListKind as St, FunctypeCollection as T, PatternString as Tn, UniversalContainer as Tt, Ref as U, isExtractable as Un, formatStackTrace as Ut, fromJSON as V, LazyList as Vn, createErrorSerializer as Vt, Matchable as W, DoResult as Wn, safeStringify as Wt, Traversable as X, Sync as Xt, SafeTraversable as Y, Ok as Yt, Lazy as Z, TaggedThrowable as Zt, TypeCheckLeft as _, Companion as _n, TagService as _t, EmptyListError as a, createCancellationTokenSource as an, TimeoutError as at, isRight as b, EmailAddress as bn, HKT as bt, LeftError as c, Throwable as cn, LayerError as ct, isDoCapable as d, Match as dn, Exit as dt, TaskMetadata as en, TestContext as et, unwrap as f, UntypedMatch as fn, ExitTag as ft, TestEither as g, isCompanion as gn, Tag as gt, Right as h, InstanceType as hn, HasService as ht, DoGenerator as i, TaskSuccess as in, Task as it, Some as j, ValidatedBrandCompanion as jn, Validator as jt, Option as k, UrlString as kn, Validation as kt, LeftErrorType as l, ThrowableType as ln, LayerInput as lt, Left as m, CompanionMethods as mn, ContextServices as mt, Do as n, TaskParams as nn, InterruptedError as nt, FailureError as o, isTaggedThrowable as on, UIO as ot, Either as p, Cond as pn, Context as pt, ESMapType as q, CancellationTokenSource as qt, DoAsync as r, TaskResult as rn, RIO as rt, FailureErrorType as s, NAME as sn, Layer as st, $ as t, TaskOutcome as tn, IO as tt, NoneError as u, Base as un, LayerOutput as ut, TypeCheckRight as v, BoundedNumber as vn, Identity as vt, FunctypeBase as w, NonNegativeNumber as wn, TryKind as wt, tryCatch as x, ISO8601Date as xn, Kind as xt, isLeft as y, BoundedString as yn, EitherKind as yt, createSerializer as z, CollectionOps as zn, ErrorWithTaskInfo as zt };
3808
+ export { Validation as $, UrlString as $t, UIO as A, isTaggedThrowable as At, Tag as B, isCompanion as Bt, TestClockTag as C, TaskFailure as Ct, RIO as D, TaskResult as Dt, InterruptedError as E, TaskParams as Et, Exit as F, Match as Ft, Kind as G, ISO8601Date as Gt, Identity as H, BoundedNumber as Ht, ExitTag as I, UntypedMatch as It, TryKind as J, NonNegativeNumber as Jt, ListKind as K, IntegerNumber as Kt, Context as L, Cond as Lt, LayerError as M, Throwable as Mt, LayerInput as N, ThrowableType as Nt, Task as O, TaskSuccess as Ot, LayerOutput as P, Base as Pt, FormValidation as Q, UUID as Qt, ContextServices as R, CompanionMethods as Rt, TestClock as S, Task$1 as St, IO as T, TaskOutcome as Tt, EitherKind as U, BoundedString as Ut, TagService as V, Companion as Vt, HKT as W, EmailAddress as Wt, FoldableUtils as X, PositiveInteger as Xt, UniversalContainer as Y, PatternString as Yt, FieldValidation as Z, PositiveNumber as Zt, MatchableUtils as _, CancellationTokenSource as _t, Stack as a, AsyncMonad as an, TypedError as at, Traversable as b, Sync as bt, SerializationResult as c, CollectionOps as cn, ErrorFormatterOptions as ct, createSerializer as d, Extractable as dn, createErrorSerializer as dt, ValidatedBrand as en, ValidationRule as et, fromBinary as f, isExtractable as fn, formatError as ft, Matchable as g, CancellationToken as gt, Ref as h, ParseError as hn, Async as ht, Collection as i, Applicative as in, ErrorStatus as it, Layer as j, NAME as jt, TimeoutError as k, createCancellationTokenSource as kt, createCustomSerializer as l, ContainerOps as ln, ErrorWithTaskInfo as lt, fromYAML as m, Doable as mn, safeStringify as mt, FunctypeBase as n, Reshapeable as nn, ErrorCode as nt, Valuable as o, Functor as on, TypedErrorContext as ot, fromJSON as p, DoResult as pn, formatStackTrace as pt, OptionKind as q, NonEmptyString as qt, FunctypeCollection as r, Promisable as rn, ErrorMessage as rt, ValuableParams as s, Monad as sn, ErrorChainElement as st, Functype as t, ValidatedBrandCompanion as tn, Validator as tt, createSerializationCompanion as u, LazyList as un, TaskErrorInfo as ut, ESMap as v, Err as vt, TestContext as w, TaskMetadata as wt, Lazy as x, TaggedThrowable as xt, ESMapType as y, Ok as yt, HasService as z, InstanceType as zt };