effect 3.17.9 → 3.17.10

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.
Files changed (49) hide show
  1. package/dist/cjs/Arbitrary.js +5 -2
  2. package/dist/cjs/Arbitrary.js.map +1 -1
  3. package/dist/cjs/Either.js.map +1 -1
  4. package/dist/cjs/JSONSchema.js +307 -364
  5. package/dist/cjs/JSONSchema.js.map +1 -1
  6. package/dist/cjs/ParseResult.js +1 -1
  7. package/dist/cjs/ParseResult.js.map +1 -1
  8. package/dist/cjs/Schema.js +17 -14
  9. package/dist/cjs/Schema.js.map +1 -1
  10. package/dist/cjs/SchemaAST.js +27 -25
  11. package/dist/cjs/SchemaAST.js.map +1 -1
  12. package/dist/cjs/internal/core-effect.js +6 -6
  13. package/dist/cjs/internal/core-effect.js.map +1 -1
  14. package/dist/cjs/internal/version.js +1 -1
  15. package/dist/cjs/internal/version.js.map +1 -1
  16. package/dist/dts/Effect.d.ts +4 -4
  17. package/dist/dts/Either.d.ts +96 -96
  18. package/dist/dts/Either.d.ts.map +1 -1
  19. package/dist/dts/JSONSchema.d.ts.map +1 -1
  20. package/dist/dts/STM.d.ts +2 -2
  21. package/dist/dts/Schema.d.ts.map +1 -1
  22. package/dist/dts/SchemaAST.d.ts +2 -0
  23. package/dist/dts/SchemaAST.d.ts.map +1 -1
  24. package/dist/esm/Arbitrary.js +5 -2
  25. package/dist/esm/Arbitrary.js.map +1 -1
  26. package/dist/esm/Either.js.map +1 -1
  27. package/dist/esm/JSONSchema.js +307 -364
  28. package/dist/esm/JSONSchema.js.map +1 -1
  29. package/dist/esm/ParseResult.js +1 -1
  30. package/dist/esm/ParseResult.js.map +1 -1
  31. package/dist/esm/Schema.js +17 -14
  32. package/dist/esm/Schema.js.map +1 -1
  33. package/dist/esm/SchemaAST.js +27 -25
  34. package/dist/esm/SchemaAST.js.map +1 -1
  35. package/dist/esm/internal/core-effect.js +6 -6
  36. package/dist/esm/internal/core-effect.js.map +1 -1
  37. package/dist/esm/internal/version.js +1 -1
  38. package/dist/esm/internal/version.js.map +1 -1
  39. package/package.json +1 -1
  40. package/src/Arbitrary.ts +4 -2
  41. package/src/Effect.ts +4 -4
  42. package/src/Either.ts +132 -132
  43. package/src/JSONSchema.ts +373 -332
  44. package/src/ParseResult.ts +1 -1
  45. package/src/STM.ts +2 -2
  46. package/src/Schema.ts +19 -12
  47. package/src/SchemaAST.ts +24 -31
  48. package/src/internal/core-effect.ts +6 -6
  49. package/src/internal/version.ts +1 -1
package/src/Either.ts CHANGED
@@ -22,7 +22,7 @@ import * as Gen from "./Utils.js"
22
22
  * @category models
23
23
  * @since 2.0.0
24
24
  */
25
- export type Either<R, L = never> = Left<L, R> | Right<L, R>
25
+ export type Either<A, E = never> = Left<E, A> | Right<E, A>
26
26
 
27
27
  /**
28
28
  * @category symbols
@@ -41,13 +41,13 @@ export type TypeId = typeof TypeId
41
41
  * @category models
42
42
  * @since 2.0.0
43
43
  */
44
- export interface Left<out L, out R> extends Pipeable, Inspectable {
44
+ export interface Left<out E, out A> extends Pipeable, Inspectable {
45
45
  readonly _tag: "Left"
46
46
  readonly _op: "Left"
47
- readonly left: L
47
+ readonly left: E
48
48
  readonly [TypeId]: {
49
- readonly _R: Covariant<R>
50
- readonly _L: Covariant<L>
49
+ readonly _R: Covariant<A>
50
+ readonly _L: Covariant<E>
51
51
  }
52
52
  [Unify.typeSymbol]?: unknown
53
53
  [Unify.unifySymbol]?: EitherUnify<this>
@@ -59,13 +59,13 @@ export interface Left<out L, out R> extends Pipeable, Inspectable {
59
59
  * @category models
60
60
  * @since 2.0.0
61
61
  */
62
- export interface Right<out L, out R> extends Pipeable, Inspectable {
62
+ export interface Right<out E, out A> extends Pipeable, Inspectable {
63
63
  readonly _tag: "Right"
64
64
  readonly _op: "Right"
65
- readonly right: R
65
+ readonly right: A
66
66
  readonly [TypeId]: {
67
- readonly _R: Covariant<R>
68
- readonly _L: Covariant<L>
67
+ readonly _R: Covariant<A>
68
+ readonly _L: Covariant<E>
69
69
  }
70
70
  [Unify.typeSymbol]?: unknown
71
71
  [Unify.unifySymbol]?: EitherUnify<this>
@@ -117,7 +117,7 @@ export declare namespace Either {
117
117
  * @category constructors
118
118
  * @since 2.0.0
119
119
  */
120
- export const right: <R>(right: R) => Either<R> = either.right
120
+ export const right: <A>(a: A) => Either<A> = either.right
121
121
 
122
122
  const void_: Either<void> = right(void 0)
123
123
  export {
@@ -135,7 +135,7 @@ export {
135
135
  * @category constructors
136
136
  * @since 2.0.0
137
137
  */
138
- export const left: <L>(left: L) => Either<never, L> = either.left
138
+ export const left: <E>(e: E) => Either<never, E> = either.left
139
139
 
140
140
  /**
141
141
  * Takes a lazy default and a nullable value, if the value is not nully (`null` or `undefined`), turn it into a `Right`, if the value is nully use
@@ -170,7 +170,7 @@ export const fromNullable: {
170
170
  * @category constructors
171
171
  * @since 2.0.0
172
172
  */
173
- <R, L>(onNullable: (right: R) => L): (self: R) => Either<NonNullable<R>, L>
173
+ <A, E>(onNullable: (right: A) => E): (self: A) => Either<NonNullable<A>, E>
174
174
  /**
175
175
  * Takes a lazy default and a nullable value, if the value is not nully (`null` or `undefined`), turn it into a `Right`, if the value is nully use
176
176
  * the provided default as a `Left`.
@@ -187,10 +187,10 @@ export const fromNullable: {
187
187
  * @category constructors
188
188
  * @since 2.0.0
189
189
  */
190
- <R, L>(self: R, onNullable: (right: R) => L): Either<NonNullable<R>, L>
190
+ <A, E>(self: A, onNullable: (right: A) => E): Either<NonNullable<A>, E>
191
191
  } = dual(
192
192
  2,
193
- <R, L>(self: R, onNullable: (right: R) => L): Either<NonNullable<R>, L> =>
193
+ <A, E>(self: A, onNullable: (right: A) => E): Either<NonNullable<A>, E> =>
194
194
  self == null ? left(onNullable(self)) : right(self)
195
195
  )
196
196
 
@@ -221,7 +221,7 @@ export const fromOption: {
221
221
  * @category constructors
222
222
  * @since 2.0.0
223
223
  */
224
- <L>(onNone: () => L): <R>(self: Option<R>) => Either<R, L>
224
+ <E>(onNone: () => E): <A>(self: Option<A>) => Either<A, E>
225
225
  /**
226
226
  * @example
227
227
  * ```ts
@@ -235,21 +235,21 @@ export const fromOption: {
235
235
  * @category constructors
236
236
  * @since 2.0.0
237
237
  */
238
- <R, L>(self: Option<R>, onNone: () => L): Either<R, L>
238
+ <A, E>(self: Option<A>, onNone: () => E): Either<A, E>
239
239
  } = either.fromOption
240
240
 
241
241
  const try_: {
242
- <R, L>(
242
+ <A, E>(
243
243
  options: {
244
- readonly try: LazyArg<R>
245
- readonly catch: (error: unknown) => L
244
+ readonly try: LazyArg<A>
245
+ readonly catch: (error: unknown) => E
246
246
  }
247
- ): Either<R, L>
248
- <R>(evaluate: LazyArg<R>): Either<R, unknown>
249
- } = (<R, L>(
250
- evaluate: LazyArg<R> | {
251
- readonly try: LazyArg<R>
252
- readonly catch: (error: unknown) => L
247
+ ): Either<A, E>
248
+ <A>(evaluate: LazyArg<A>): Either<A, unknown>
249
+ } = (<A, E>(
250
+ evaluate: LazyArg<A> | {
251
+ readonly try: LazyArg<A>
252
+ readonly catch: (error: unknown) => E
253
253
  }
254
254
  ) => {
255
255
  if (isFunction(evaluate)) {
@@ -311,7 +311,7 @@ export const isEither: (input: unknown) => input is Either<unknown, unknown> = e
311
311
  * @category guards
312
312
  * @since 2.0.0
313
313
  */
314
- export const isLeft: <R, L>(self: Either<R, L>) => self is Left<L, R> = either.isLeft
314
+ export const isLeft: <A, E>(self: Either<A, E>) => self is Left<E, A> = either.isLeft
315
315
 
316
316
  /**
317
317
  * Determine if a `Either` is a `Right`.
@@ -328,7 +328,7 @@ export const isLeft: <R, L>(self: Either<R, L>) => self is Left<L, R> = either.i
328
328
  * @category guards
329
329
  * @since 2.0.0
330
330
  */
331
- export const isRight: <R, L>(self: Either<R, L>) => self is Right<L, R> = either.isRight
331
+ export const isRight: <A, E>(self: Either<A, E>) => self is Right<E, A> = either.isRight
332
332
 
333
333
  /**
334
334
  * Converts a `Either` to an `Option` discarding the `Left`.
@@ -345,7 +345,7 @@ export const isRight: <R, L>(self: Either<R, L>) => self is Right<L, R> = either
345
345
  * @category getters
346
346
  * @since 2.0.0
347
347
  */
348
- export const getRight: <R, L>(self: Either<R, L>) => Option<R> = either.getRight
348
+ export const getRight: <A, E>(self: Either<A, E>) => Option<A> = either.getRight
349
349
 
350
350
  /**
351
351
  * Converts a `Either` to an `Option` discarding the value.
@@ -362,16 +362,16 @@ export const getRight: <R, L>(self: Either<R, L>) => Option<R> = either.getRight
362
362
  * @category getters
363
363
  * @since 2.0.0
364
364
  */
365
- export const getLeft: <R, L>(self: Either<R, L>) => Option<L> = either.getLeft
365
+ export const getLeft: <A, E>(self: Either<A, E>) => Option<E> = either.getLeft
366
366
 
367
367
  /**
368
368
  * @category equivalence
369
369
  * @since 2.0.0
370
370
  */
371
- export const getEquivalence = <R, L>({ left, right }: {
372
- right: Equivalence.Equivalence<R>
373
- left: Equivalence.Equivalence<L>
374
- }): Equivalence.Equivalence<Either<R, L>> =>
371
+ export const getEquivalence = <A, E>({ left, right }: {
372
+ right: Equivalence.Equivalence<A>
373
+ left: Equivalence.Equivalence<E>
374
+ }): Equivalence.Equivalence<Either<A, E>> =>
375
375
  Equivalence.make((x, y) =>
376
376
  isLeft(x) ?
377
377
  isLeft(y) && left(x.left, y.left) :
@@ -387,29 +387,29 @@ export const mapBoth: {
387
387
  * @category mapping
388
388
  * @since 2.0.0
389
389
  */
390
- <L, L2, R, R2>(
390
+ <E, E2, A, A2>(
391
391
  options: {
392
- readonly onLeft: (left: L) => L2
393
- readonly onRight: (right: R) => R2
392
+ readonly onLeft: (left: E) => E2
393
+ readonly onRight: (right: A) => A2
394
394
  }
395
- ): (self: Either<R, L>) => Either<R2, L2>
395
+ ): (self: Either<A, E>) => Either<A2, E2>
396
396
  /**
397
397
  * @category mapping
398
398
  * @since 2.0.0
399
399
  */
400
- <L, R, L2, R2>(
401
- self: Either<R, L>,
400
+ <A, E, E2, A2>(
401
+ self: Either<A, E>,
402
402
  options: {
403
- readonly onLeft: (left: L) => L2
404
- readonly onRight: (right: R) => R2
403
+ readonly onLeft: (left: E) => E2
404
+ readonly onRight: (right: A) => A2
405
405
  }
406
- ): Either<R2, L2>
406
+ ): Either<A2, E2>
407
407
  } = dual(
408
408
  2,
409
- <L, R, L2, R2>(self: Either<R, L>, { onLeft, onRight }: {
410
- readonly onLeft: (left: L) => L2
411
- readonly onRight: (right: R) => R2
412
- }): Either<R2, L2> => isLeft(self) ? left(onLeft(self.left)) : right(onRight(self.right))
409
+ <A, E, E2, A2>(self: Either<A, E>, { onLeft, onRight }: {
410
+ readonly onLeft: (left: E) => E2
411
+ readonly onRight: (right: A) => A2
412
+ }): Either<A2, E2> => isLeft(self) ? left(onLeft(self.left)) : right(onRight(self.right))
413
413
  )
414
414
 
415
415
  /**
@@ -425,17 +425,17 @@ export const mapLeft: {
425
425
  * @category mapping
426
426
  * @since 2.0.0
427
427
  */
428
- <L, L2>(f: (left: L) => L2): <R>(self: Either<R, L>) => Either<R, L2>
428
+ <E, E2>(f: (left: E) => E2): <A>(self: Either<A, E>) => Either<A, E2>
429
429
  /**
430
430
  * Maps the `Left` side of an `Either` value to a new `Either` value.
431
431
  *
432
432
  * @category mapping
433
433
  * @since 2.0.0
434
434
  */
435
- <R, L, L2>(self: Either<R, L>, f: (left: L) => L2): Either<R, L2>
435
+ <A, E, E2>(self: Either<A, E>, f: (left: E) => E2): Either<A, E2>
436
436
  } = dual(
437
437
  2,
438
- <R, L1, L2>(self: Either<R, L1>, f: (left: L1) => L2): Either<R, L2> =>
438
+ <A, E, E2>(self: Either<A, E>, f: (left: E) => E2): Either<A, E2> =>
439
439
  isLeft(self) ? left(f(self.left)) : right(self.right)
440
440
  )
441
441
 
@@ -452,17 +452,17 @@ export const map: {
452
452
  * @category mapping
453
453
  * @since 2.0.0
454
454
  */
455
- <R, R2>(f: (right: R) => R2): <L>(self: Either<R, L>) => Either<R2, L>
455
+ <A, A2>(f: (right: A) => A2): <E>(self: Either<A, E>) => Either<A2, E>
456
456
  /**
457
457
  * Maps the `Right` side of an `Either` value to a new `Either` value.
458
458
  *
459
459
  * @category mapping
460
460
  * @since 2.0.0
461
461
  */
462
- <R, L, R2>(self: Either<R, L>, f: (right: R) => R2): Either<R2, L>
462
+ <A, E, A2>(self: Either<A, E>, f: (right: A) => A2): Either<A2, E>
463
463
  } = dual(
464
464
  2,
465
- <R1, L, R2>(self: Either<R1, L>, f: (right: R1) => R2): Either<R2, L> =>
465
+ <A, E, A2>(self: Either<A, E>, f: (right: A) => A2): Either<A2, E> =>
466
466
  isRight(self) ? right(f(self.right)) : left(self.left)
467
467
  )
468
468
 
@@ -513,12 +513,12 @@ export const match: {
513
513
  * @category pattern matching
514
514
  * @since 2.0.0
515
515
  */
516
- <L, B, R, C = B>(
516
+ <E, B, A, C = B>(
517
517
  options: {
518
- readonly onLeft: (left: L) => B
519
- readonly onRight: (right: R) => C
518
+ readonly onLeft: (left: E) => B
519
+ readonly onRight: (right: A) => C
520
520
  }
521
- ): (self: Either<R, L>) => B | C
521
+ ): (self: Either<A, E>) => B | C
522
522
  /**
523
523
  * Takes two functions and an `Either` value, if the value is a `Left` the inner value is applied to the `onLeft function,
524
524
  * if the value is a `Right` the inner value is applied to the `onRight` function.
@@ -542,18 +542,18 @@ export const match: {
542
542
  * @category pattern matching
543
543
  * @since 2.0.0
544
544
  */
545
- <R, L, B, C = B>(
546
- self: Either<R, L>,
545
+ <A, E, B, C = B>(
546
+ self: Either<A, E>,
547
547
  options: {
548
- readonly onLeft: (left: L) => B
549
- readonly onRight: (right: R) => C
548
+ readonly onLeft: (left: E) => B
549
+ readonly onRight: (right: A) => C
550
550
  }
551
551
  ): B | C
552
552
  } = dual(
553
553
  2,
554
- <R, L, B, C = B>(self: Either<R, L>, { onLeft, onRight }: {
555
- readonly onLeft: (left: L) => B
556
- readonly onRight: (right: R) => C
554
+ <A, E, B, C = B>(self: Either<A, E>, { onLeft, onRight }: {
555
+ readonly onLeft: (left: E) => B
556
+ readonly onRight: (right: A) => C
557
557
  }): B | C => isLeft(self) ? onLeft(self.left) : onRight(self.right)
558
558
  )
559
559
 
@@ -754,10 +754,10 @@ export const filterOrLeft: {
754
754
  * @since 2.0.0
755
755
  * @category filtering & conditionals
756
756
  */
757
- <R, B extends R, L2>(
758
- refinement: Refinement<NoInfer<R>, B>,
759
- orLeftWith: (right: NoInfer<R>) => L2
760
- ): <L>(self: Either<R, L>) => Either<B, L2 | L>
757
+ <A, B extends A, E2>(
758
+ refinement: Refinement<NoInfer<A>, B>,
759
+ orLeftWith: (right: NoInfer<A>) => E2
760
+ ): <E>(self: Either<A, E>) => Either<B, E2 | E>
761
761
  /**
762
762
  * Filter the right value with the provided function.
763
763
  * If the predicate fails, set the left value with the result of the provided function.
@@ -788,7 +788,7 @@ export const filterOrLeft: {
788
788
  * @since 2.0.0
789
789
  * @category filtering & conditionals
790
790
  */
791
- <R, L2>(predicate: Predicate<NoInfer<R>>, orLeftWith: (right: NoInfer<R>) => L2): <L>(self: Either<R, L>) => Either<R, L2 | L>
791
+ <A, E2>(predicate: Predicate<NoInfer<A>>, orLeftWith: (right: NoInfer<A>) => E2): <E>(self: Either<A, E>) => Either<A, E2 | E>
792
792
  /**
793
793
  * Filter the right value with the provided function.
794
794
  * If the predicate fails, set the left value with the result of the provided function.
@@ -819,11 +819,11 @@ export const filterOrLeft: {
819
819
  * @since 2.0.0
820
820
  * @category filtering & conditionals
821
821
  */
822
- <R, L, B extends R, L2>(
823
- self: Either<R, L>,
824
- refinement: Refinement<R, B>,
825
- orLeftWith: (right: R) => L2
826
- ): Either<B, L | L2>
822
+ <A, E, B extends A, E2>(
823
+ self: Either<A, E>,
824
+ refinement: Refinement<A, B>,
825
+ orLeftWith: (right: A) => E2
826
+ ): Either<B, E | E2>
827
827
  /**
828
828
  * Filter the right value with the provided function.
829
829
  * If the predicate fails, set the left value with the result of the provided function.
@@ -854,18 +854,18 @@ export const filterOrLeft: {
854
854
  * @since 2.0.0
855
855
  * @category filtering & conditionals
856
856
  */
857
- <R, L, E2>(self: Either<R, L>, predicate: Predicate<R>, orLeftWith: (right: R) => E2): Either<R, L | E2>
858
- } = dual(3, <R, L, E2>(
859
- self: Either<R, L>,
860
- predicate: Predicate<R>,
861
- orLeftWith: (right: R) => E2
862
- ): Either<R, L | E2> => flatMap(self, (r) => predicate(r) ? right(r) : left(orLeftWith(r))))
857
+ <A, E, E2>(self: Either<A, E>, predicate: Predicate<A>, orLeftWith: (right: A) => E2): Either<A, E | E2>
858
+ } = dual(3, <A, E, E2>(
859
+ self: Either<A, E>,
860
+ predicate: Predicate<A>,
861
+ orLeftWith: (right: A) => E2
862
+ ): Either<A, E | E2> => flatMap(self, (r) => predicate(r) ? right(r) : left(orLeftWith(r))))
863
863
 
864
864
  /**
865
865
  * @category getters
866
866
  * @since 2.0.0
867
867
  */
868
- export const merge: <R, L>(self: Either<R, L>) => L | R = match({
868
+ export const merge: <A, E>(self: Either<A, E>) => E | A = match({
869
869
  onLeft: identity,
870
870
  onRight: identity
871
871
  })
@@ -901,7 +901,7 @@ export const getOrElse: {
901
901
  * @category getters
902
902
  * @since 2.0.0
903
903
  */
904
- <L, R2>(onLeft: (left: L) => R2): <R>(self: Either<R, L>) => R2 | R
904
+ <E, A2>(onLeft: (left: E) => A2): <A>(self: Either<A, E>) => A2 | A
905
905
  /**
906
906
  * Returns the wrapped value if it's a `Right` or a default value if is a `Left`.
907
907
  *
@@ -917,10 +917,10 @@ export const getOrElse: {
917
917
  * @category getters
918
918
  * @since 2.0.0
919
919
  */
920
- <R, L, R2>(self: Either<R, L>, onLeft: (left: L) => R2): R | R2
920
+ <A, E, A2>(self: Either<A, E>, onLeft: (left: E) => A2): A | A2
921
921
  } = dual(
922
922
  2,
923
- <R, L, B>(self: Either<R, L>, onLeft: (left: L) => B): R | B => isLeft(self) ? onLeft(self.left) : self.right
923
+ <A, E, A2>(self: Either<A, E>, onLeft: (left: E) => A2): A | A2 => isLeft(self) ? onLeft(self.left) : self.right
924
924
  )
925
925
 
926
926
  /**
@@ -936,7 +936,7 @@ export const getOrElse: {
936
936
  * @category getters
937
937
  * @since 2.0.0
938
938
  */
939
- export const getOrNull: <R, L>(self: Either<R, L>) => R | null = getOrElse(constNull)
939
+ export const getOrNull: <A, E>(self: Either<A, E>) => A | null = getOrElse(constNull)
940
940
 
941
941
  /**
942
942
  * @example
@@ -951,7 +951,7 @@ export const getOrNull: <R, L>(self: Either<R, L>) => R | null = getOrElse(const
951
951
  * @category getters
952
952
  * @since 2.0.0
953
953
  */
954
- export const getOrUndefined: <R, L>(self: Either<R, L>) => R | undefined = getOrElse(constUndefined)
954
+ export const getOrUndefined: <A, E>(self: Either<A, E>) => A | undefined = getOrElse(constUndefined)
955
955
 
956
956
  /**
957
957
  * Extracts the value of an `Either` or throws if the `Either` is `Left`.
@@ -994,7 +994,7 @@ export const getOrThrowWith: {
994
994
  * @category getters
995
995
  * @since 2.0.0
996
996
  */
997
- <L>(onLeft: (left: L) => unknown): <A>(self: Either<A, L>) => A
997
+ <E>(onLeft: (left: E) => unknown): <A>(self: Either<A, E>) => A
998
998
  /**
999
999
  * Extracts the value of an `Either` or throws if the `Either` is `Left`.
1000
1000
  *
@@ -1015,8 +1015,8 @@ export const getOrThrowWith: {
1015
1015
  * @category getters
1016
1016
  * @since 2.0.0
1017
1017
  */
1018
- <R, L>(self: Either<R, L>, onLeft: (left: L) => unknown): R
1019
- } = dual(2, <R, L>(self: Either<R, L>, onLeft: (left: L) => unknown): R => {
1018
+ <A, E>(self: Either<A, E>, onLeft: (left: E) => unknown): A
1019
+ } = dual(2, <A, E>(self: Either<A, E>, onLeft: (left: E) => unknown): A => {
1020
1020
  if (isRight(self)) {
1021
1021
  return self.right
1022
1022
  }
@@ -1043,7 +1043,7 @@ export const getOrThrowWith: {
1043
1043
  * @category getters
1044
1044
  * @since 2.0.0
1045
1045
  */
1046
- export const getOrThrow: <R, L>(self: Either<R, L>) => R = getOrThrowWith(() =>
1046
+ export const getOrThrow: <A, E>(self: Either<A, E>) => A = getOrThrowWith(() =>
1047
1047
  new Error("getOrThrow called on a Left")
1048
1048
  )
1049
1049
 
@@ -1060,17 +1060,17 @@ export const orElse: {
1060
1060
  * @category error handling
1061
1061
  * @since 2.0.0
1062
1062
  */
1063
- <L, R2, L2>(that: (left: L) => Either<R2, L2>): <R>(self: Either<R, L>) => Either<R | R2, L2>
1063
+ <E, A2, E2>(that: (left: E) => Either<A2, E2>): <A>(self: Either<A, E>) => Either<A | A2, E2>
1064
1064
  /**
1065
1065
  * Returns `self` if it is a `Right` or `that` otherwise.
1066
1066
  *
1067
1067
  * @category error handling
1068
1068
  * @since 2.0.0
1069
1069
  */
1070
- <R, L, R2, L2>(self: Either<R, L>, that: (left: L) => Either<R2, L2>): Either<R | R2, L2>
1070
+ <A, E, A2, E2>(self: Either<A, E>, that: (left: E) => Either<A2, E2>): Either<A | A2, E2>
1071
1071
  } = dual(
1072
1072
  2,
1073
- <R1, L1, R2, L2>(self: Either<R1, L1>, that: (left: L1) => Either<R2, L2>): Either<R1 | R2, L2> =>
1073
+ <A, E, A2, E2>(self: Either<A, E>, that: (left: E) => Either<A2, E2>): Either<A | A2, E2> =>
1074
1074
  isLeft(self) ? that(self.left) : right(self.right)
1075
1075
  )
1076
1076
 
@@ -1083,15 +1083,15 @@ export const flatMap: {
1083
1083
  * @category sequencing
1084
1084
  * @since 2.0.0
1085
1085
  */
1086
- <R, R2, L2>(f: (right: R) => Either<R2, L2>): <L>(self: Either<R, L>) => Either<R2, L | L2>
1086
+ <A, A2, E2>(f: (right: A) => Either<A2, E2>): <E>(self: Either<A, E>) => Either<A2, E | E2>
1087
1087
  /**
1088
1088
  * @category sequencing
1089
1089
  * @since 2.0.0
1090
1090
  */
1091
- <R, L, R2, L2>(self: Either<R, L>, f: (right: R) => Either<R2, L2>): Either<R2, L | L2>
1091
+ <A, E, A2, E2>(self: Either<A, E>, f: (right: A) => Either<A2, E2>): Either<A2, E | E2>
1092
1092
  } = dual(
1093
1093
  2,
1094
- <R1, L1, R2, L2>(self: Either<R1, L1>, f: (right: R1) => Either<R2, L2>): Either<R2, L1 | L2> =>
1094
+ <A, E, A2, E2>(self: Either<A, E>, f: (right: A) => Either<A2, E2>): Either<A2, E | E2> =>
1095
1095
  isLeft(self) ? left(self.left) : f(self.right)
1096
1096
  )
1097
1097
 
@@ -1108,59 +1108,59 @@ export const andThen: {
1108
1108
  * @category sequencing
1109
1109
  * @since 2.0.0
1110
1110
  */
1111
- <R, R2, L2>(f: (right: R) => Either<R2, L2>): <L>(self: Either<R, L>) => Either<R2, L | L2>
1111
+ <A, A2, E2>(f: (right: A) => Either<A2, E2>): <E>(self: Either<A, E>) => Either<A2, E | E2>
1112
1112
  /**
1113
1113
  * Executes a sequence of two `Either`s. The second `Either` can be dependent on the result of the first `Either`.
1114
1114
  *
1115
1115
  * @category sequencing
1116
1116
  * @since 2.0.0
1117
1117
  */
1118
- <R2, L2>(f: Either<R2, L2>): <L, R1>(self: Either<R1, L>) => Either<R2, L | L2>
1118
+ <A2, E2>(f: Either<A2, E2>): <E, A>(self: Either<A, E>) => Either<A2, E | E2>
1119
1119
  /**
1120
1120
  * Executes a sequence of two `Either`s. The second `Either` can be dependent on the result of the first `Either`.
1121
1121
  *
1122
1122
  * @category sequencing
1123
1123
  * @since 2.0.0
1124
1124
  */
1125
- <R, R2>(f: (right: R) => R2): <L>(self: Either<R, L>) => Either<R2, L>
1125
+ <A, A2>(f: (right: A) => A2): <E>(self: Either<A, E>) => Either<A2, E>
1126
1126
  /**
1127
1127
  * Executes a sequence of two `Either`s. The second `Either` can be dependent on the result of the first `Either`.
1128
1128
  *
1129
1129
  * @category sequencing
1130
1130
  * @since 2.0.0
1131
1131
  */
1132
- <R2>(right: NotFunction<R2>): <R1, L>(self: Either<R1, L>) => Either<R2, L>
1132
+ <A2>(right: NotFunction<A2>): <A, E>(self: Either<A, E>) => Either<A2, E>
1133
1133
  /**
1134
1134
  * Executes a sequence of two `Either`s. The second `Either` can be dependent on the result of the first `Either`.
1135
1135
  *
1136
1136
  * @category sequencing
1137
1137
  * @since 2.0.0
1138
1138
  */
1139
- <R, L, R2, L2>(self: Either<R, L>, f: (right: R) => Either<R2, L2>): Either<R2, L | L2>
1139
+ <A, E, A2, E2>(self: Either<A, E>, f: (right: A) => Either<A2, E2>): Either<A2, E | E2>
1140
1140
  /**
1141
1141
  * Executes a sequence of two `Either`s. The second `Either` can be dependent on the result of the first `Either`.
1142
1142
  *
1143
1143
  * @category sequencing
1144
1144
  * @since 2.0.0
1145
1145
  */
1146
- <R, L, R2, L2>(self: Either<R, L>, f: Either<R2, L2>): Either<R2, L | L2>
1146
+ <A, E, A2, E2>(self: Either<A, E>, f: Either<A2, E2>): Either<A2, E | E2>
1147
1147
  /**
1148
1148
  * Executes a sequence of two `Either`s. The second `Either` can be dependent on the result of the first `Either`.
1149
1149
  *
1150
1150
  * @category sequencing
1151
1151
  * @since 2.0.0
1152
1152
  */
1153
- <R, L, R2>(self: Either<R, L>, f: (right: R) => R2): Either<R2, L>
1153
+ <A, E, A2>(self: Either<A, E>, f: (right: A) => A2): Either<A2, E>
1154
1154
  /**
1155
1155
  * Executes a sequence of two `Either`s. The second `Either` can be dependent on the result of the first `Either`.
1156
1156
  *
1157
1157
  * @category sequencing
1158
1158
  * @since 2.0.0
1159
1159
  */
1160
- <R, L, R2>(self: Either<R, L>, f: NotFunction<R2>): Either<R2, L>
1160
+ <A, E, A2>(self: Either<A, E>, f: NotFunction<A2>): Either<A2, E>
1161
1161
  } = dual(
1162
1162
  2,
1163
- <R, L, R2, L2>(self: Either<R, L>, f: (right: R) => Either<R2, L2> | Either<R2, L2>): Either<R2, L | L2> =>
1163
+ <A, E, A2, E2>(self: Either<A, E>, f: (right: A) => Either<A2, E2> | Either<A2, E2>): Either<A2, E | E2> =>
1164
1164
  flatMap(self, (a) => {
1165
1165
  const b = isFunction(f) ? f(a) : f
1166
1166
  return isEither(b) ? b : right(b)
@@ -1176,15 +1176,15 @@ export const zipWith: {
1176
1176
  * @category zipping
1177
1177
  * @since 2.0.0
1178
1178
  */
1179
- <R2, L2, R, B>(that: Either<R2, L2>, f: (right: R, right2: R2) => B): <L>(self: Either<R, L>) => Either<B, L2 | L>
1179
+ <A2, E2, A, B>(that: Either<A2, E2>, f: (right: A, right2: A2) => B): <E>(self: Either<A, E>) => Either<B, E2 | E>
1180
1180
  /**
1181
1181
  * @category zipping
1182
1182
  * @since 2.0.0
1183
1183
  */
1184
- <R, L, R2, L2, B>(self: Either<R, L>, that: Either<R2, L2>, f: (right: R, right2: R2) => B): Either<B, L | L2>
1184
+ <A, E, A2, E2, B>(self: Either<A, E>, that: Either<A2, E2>, f: (right: A, right2: A2) => B): Either<B, E | E2>
1185
1185
  } = dual(
1186
1186
  3,
1187
- <R, L, R2, L2, B>(self: Either<R, L>, that: Either<R2, L2>, f: (right: R, right2: R2) => B): Either<B, L | L2> =>
1187
+ <A, E, A2, E2, B>(self: Either<A, E>, that: Either<A2, E2>, f: (right: A, right2: A2) => B): Either<B, E | E2> =>
1188
1188
  flatMap(self, (r) => map(that, (r2) => f(r, r2)))
1189
1189
  )
1190
1190
 
@@ -1197,15 +1197,15 @@ export const ap: {
1197
1197
  * @category combining
1198
1198
  * @since 2.0.0
1199
1199
  */
1200
- <R, L2>(that: Either<R, L2>): <R2, L>(self: Either<(right: R) => R2, L>) => Either<R2, L | L2>
1200
+ <A, E2>(that: Either<A, E2>): <A2, E>(self: Either<(right: A) => A2, E>) => Either<A2, E | E2>
1201
1201
  /**
1202
1202
  * @category combining
1203
1203
  * @since 2.0.0
1204
1204
  */
1205
- <R, R2, L, L2>(self: Either<(right: R) => R2, L>, that: Either<R, L2>): Either<R2, L | L2>
1205
+ <A, A2, E, E2>(self: Either<(right: A) => A2, E>, that: Either<A, E2>): Either<A2, E | E2>
1206
1206
  } = dual(
1207
1207
  2,
1208
- <R, R2, L, L2>(self: Either<(right: R) => R2, L>, that: Either<R, L2>): Either<R2, L | L2> =>
1208
+ <A, E, A2, E2>(self: Either<(right: A) => A2, E>, that: Either<A, E2>): Either<A2, E | E2> =>
1209
1209
  zipWith(self, that, (f, a) => f(a))
1210
1210
  )
1211
1211
 
@@ -1233,13 +1233,13 @@ export const ap: {
1233
1233
  export const all: <const I extends Iterable<Either<any, any>> | Record<string, Either<any, any>>>(
1234
1234
  input: I
1235
1235
  ) => [I] extends [ReadonlyArray<Either<any, any>>] ? Either<
1236
- { -readonly [K in keyof I]: [I[K]] extends [Either<infer R, any>] ? R : never },
1237
- I[number] extends never ? never : [I[number]] extends [Either<any, infer L>] ? L : never
1236
+ { -readonly [K in keyof I]: [I[K]] extends [Either<infer A, any>] ? A : never },
1237
+ I[number] extends never ? never : [I[number]] extends [Either<any, infer E>] ? E : never
1238
1238
  >
1239
- : [I] extends [Iterable<Either<infer R, infer L>>] ? Either<Array<R>, L>
1239
+ : [I] extends [Iterable<Either<infer A, infer E>>] ? Either<Array<A>, E>
1240
1240
  : Either<
1241
- { -readonly [K in keyof I]: [I[K]] extends [Either<infer R, any>] ? R : never },
1242
- I[keyof I] extends never ? never : [I[keyof I]] extends [Either<any, infer L>] ? L : never
1241
+ { -readonly [K in keyof I]: [I[K]] extends [Either<infer A, any>] ? A : never },
1242
+ I[keyof I] extends never ? never : [I[keyof I]] extends [Either<any, infer E>] ? E : never
1243
1243
  > = (
1244
1244
  input: Iterable<Either<any, any>> | Record<string, Either<any, any>>
1245
1245
  ): Either<any, any> => {
@@ -1272,7 +1272,7 @@ export const all: <const I extends Iterable<Either<any, any>> | Record<string, E
1272
1272
  * @since 2.0.0
1273
1273
  * @category mapping
1274
1274
  */
1275
- export const flip = <R, L>(self: Either<R, L>): Either<L, R> => isLeft(self) ? right(self.left) : left(self.right)
1275
+ export const flip = <A, E>(self: Either<A, E>): Either<E, A> => isLeft(self) ? right(self.left) : left(self.right)
1276
1276
 
1277
1277
  const adapter = Gen.adapter<EitherTypeLambda>()
1278
1278
 
@@ -1396,7 +1396,7 @@ export const bind: {
1396
1396
  * @category do notation
1397
1397
  * @since 2.0.0
1398
1398
  */
1399
- <N extends string, A extends object, B, L2>(name: Exclude<N, keyof A>, f: (a: NoInfer<A>) => Either<B, L2>): <L1>(self: Either<A, L1>) => Either<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }, L1 | L2>
1399
+ <N extends string, A extends object, B, E2>(name: Exclude<N, keyof A>, f: (a: NoInfer<A>) => Either<B, E2>): <E>(self: Either<A, E>) => Either<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }, E | E2>
1400
1400
  /**
1401
1401
  * The "do simulation" in Effect allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
1402
1402
  *
@@ -1428,11 +1428,11 @@ export const bind: {
1428
1428
  * @category do notation
1429
1429
  * @since 2.0.0
1430
1430
  */
1431
- <A extends object, L1, N extends string, B, L2>(
1432
- self: Either<A, L1>,
1431
+ <A extends object, E, N extends string, B, E2>(
1432
+ self: Either<A, E>,
1433
1433
  name: Exclude<N, keyof A>,
1434
- f: (a: NoInfer<A>) => Either<B, L2>
1435
- ): Either<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }, L1 | L2>
1434
+ f: (a: NoInfer<A>) => Either<B, E2>
1435
+ ): Either<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }, E | E2>
1436
1436
  } = doNotation.bind<EitherTypeLambda>(map, flatMap)
1437
1437
 
1438
1438
  /**
@@ -1498,7 +1498,7 @@ export const bindTo: {
1498
1498
  * @category do notation
1499
1499
  * @since 2.0.0
1500
1500
  */
1501
- <N extends string>(name: N): <R, L>(self: Either<R, L>) => Either<{ [K in N]: R }, L>
1501
+ <N extends string>(name: N): <A, E>(self: Either<A, E>) => Either<{ [K in N]: A }, E>
1502
1502
  /**
1503
1503
  * The "do simulation" in Effect allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
1504
1504
  *
@@ -1530,19 +1530,19 @@ export const bindTo: {
1530
1530
  * @category do notation
1531
1531
  * @since 2.0.0
1532
1532
  */
1533
- <R, L, N extends string>(self: Either<R, L>, name: N): Either<{ [K in N]: R }, L>
1533
+ <A, E, N extends string>(self: Either<A, E>, name: N): Either<{ [K in N]: A }, E>
1534
1534
  } = doNotation.bindTo<EitherTypeLambda>(map)
1535
1535
 
1536
1536
  const let_: {
1537
- <N extends string, R extends object, B>(
1538
- name: Exclude<N, keyof R>,
1539
- f: (r: NoInfer<R>) => B
1540
- ): <L>(self: Either<R, L>) => Either<{ [K in N | keyof R]: K extends keyof R ? R[K] : B }, L>
1541
- <R extends object, L, N extends string, B>(
1542
- self: Either<R, L>,
1543
- name: Exclude<N, keyof R>,
1544
- f: (r: NoInfer<R>) => B
1545
- ): Either<{ [K in N | keyof R]: K extends keyof R ? R[K] : B }, L>
1537
+ <N extends string, A extends object, B>(
1538
+ name: Exclude<N, keyof A>,
1539
+ f: (r: NoInfer<A>) => B
1540
+ ): <E>(self: Either<A, E>) => Either<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }, E>
1541
+ <A extends object, E, N extends string, B>(
1542
+ self: Either<A, E>,
1543
+ name: Exclude<N, keyof A>,
1544
+ f: (r: NoInfer<A>) => B
1545
+ ): Either<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }, E>
1546
1546
  } = doNotation.let_<EitherTypeLambda>(map)
1547
1547
 
1548
1548
  export {