effect 3.13.9 → 3.13.11

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 (119) hide show
  1. package/dist/cjs/Arbitrary.js +38 -22
  2. package/dist/cjs/Arbitrary.js.map +1 -1
  3. package/dist/cjs/Array.js +50 -50
  4. package/dist/cjs/Array.js.map +1 -1
  5. package/dist/cjs/Brand.js +9 -4
  6. package/dist/cjs/Brand.js.map +1 -1
  7. package/dist/cjs/Cause.js +1 -0
  8. package/dist/cjs/Cause.js.map +1 -1
  9. package/dist/cjs/Chunk.js +25 -23
  10. package/dist/cjs/Chunk.js.map +1 -1
  11. package/dist/cjs/Config.js +2 -1
  12. package/dist/cjs/Config.js.map +1 -1
  13. package/dist/cjs/Context.js +4 -4
  14. package/dist/cjs/Effect.js +823 -632
  15. package/dist/cjs/Effect.js.map +1 -1
  16. package/dist/cjs/Either.js +12 -12
  17. package/dist/cjs/Either.js.map +1 -1
  18. package/dist/cjs/LogLevel.js +1 -1
  19. package/dist/cjs/Logger.js +12 -12
  20. package/dist/cjs/Match.js +26 -26
  21. package/dist/cjs/Option.js +43 -43
  22. package/dist/cjs/Predicate.js +6 -2
  23. package/dist/cjs/Predicate.js.map +1 -1
  24. package/dist/cjs/Schema.js +21 -17
  25. package/dist/cjs/Schema.js.map +1 -1
  26. package/dist/cjs/SchemaAST.js +49 -25
  27. package/dist/cjs/SchemaAST.js.map +1 -1
  28. package/dist/cjs/Scope.js +2 -0
  29. package/dist/cjs/Scope.js.map +1 -1
  30. package/dist/cjs/Stream.js +93 -93
  31. package/dist/cjs/internal/core.js +1 -1
  32. package/dist/cjs/internal/core.js.map +1 -1
  33. package/dist/cjs/internal/schema/util.js +23 -14
  34. package/dist/cjs/internal/schema/util.js.map +1 -1
  35. package/dist/cjs/internal/version.js +1 -1
  36. package/dist/cjs/internal/version.js.map +1 -1
  37. package/dist/dts/Array.d.ts +47 -47
  38. package/dist/dts/Array.d.ts.map +1 -1
  39. package/dist/dts/Brand.d.ts +14 -6
  40. package/dist/dts/Brand.d.ts.map +1 -1
  41. package/dist/dts/Cause.d.ts +1 -0
  42. package/dist/dts/Cause.d.ts.map +1 -1
  43. package/dist/dts/Chunk.d.ts +91 -89
  44. package/dist/dts/Chunk.d.ts.map +1 -1
  45. package/dist/dts/Config.d.ts +2 -1
  46. package/dist/dts/Config.d.ts.map +1 -1
  47. package/dist/dts/Context.d.ts +4 -4
  48. package/dist/dts/Effect.d.ts +2107 -1621
  49. package/dist/dts/Effect.d.ts.map +1 -1
  50. package/dist/dts/Either.d.ts +33 -33
  51. package/dist/dts/LogLevel.d.ts +3 -3
  52. package/dist/dts/Logger.d.ts +16 -16
  53. package/dist/dts/Match.d.ts +26 -26
  54. package/dist/dts/Option.d.ts +84 -84
  55. package/dist/dts/Predicate.d.ts.map +1 -1
  56. package/dist/dts/Schema.d.ts +53 -21
  57. package/dist/dts/Schema.d.ts.map +1 -1
  58. package/dist/dts/SchemaAST.d.ts.map +1 -1
  59. package/dist/dts/Scope.d.ts +2 -0
  60. package/dist/dts/Scope.d.ts.map +1 -1
  61. package/dist/dts/Stream.d.ts +229 -229
  62. package/dist/esm/Arbitrary.js +38 -22
  63. package/dist/esm/Arbitrary.js.map +1 -1
  64. package/dist/esm/Array.js +50 -50
  65. package/dist/esm/Array.js.map +1 -1
  66. package/dist/esm/Brand.js +9 -4
  67. package/dist/esm/Brand.js.map +1 -1
  68. package/dist/esm/Cause.js +1 -0
  69. package/dist/esm/Cause.js.map +1 -1
  70. package/dist/esm/Chunk.js +25 -23
  71. package/dist/esm/Chunk.js.map +1 -1
  72. package/dist/esm/Config.js +2 -1
  73. package/dist/esm/Config.js.map +1 -1
  74. package/dist/esm/Context.js +4 -4
  75. package/dist/esm/Effect.js +845 -648
  76. package/dist/esm/Effect.js.map +1 -1
  77. package/dist/esm/Either.js +17 -17
  78. package/dist/esm/Either.js.map +1 -1
  79. package/dist/esm/LogLevel.js +1 -1
  80. package/dist/esm/Logger.js +12 -12
  81. package/dist/esm/Match.js +26 -26
  82. package/dist/esm/Option.js +48 -48
  83. package/dist/esm/Predicate.js +3 -0
  84. package/dist/esm/Predicate.js.map +1 -1
  85. package/dist/esm/Schema.js +21 -17
  86. package/dist/esm/Schema.js.map +1 -1
  87. package/dist/esm/SchemaAST.js +46 -22
  88. package/dist/esm/SchemaAST.js.map +1 -1
  89. package/dist/esm/Scope.js +2 -0
  90. package/dist/esm/Scope.js.map +1 -1
  91. package/dist/esm/Stream.js +101 -101
  92. package/dist/esm/internal/core.js +1 -1
  93. package/dist/esm/internal/core.js.map +1 -1
  94. package/dist/esm/internal/schema/util.js +23 -14
  95. package/dist/esm/internal/schema/util.js.map +1 -1
  96. package/dist/esm/internal/version.js +1 -1
  97. package/dist/esm/internal/version.js.map +1 -1
  98. package/package.json +1 -1
  99. package/src/Arbitrary.ts +39 -24
  100. package/src/Array.ts +116 -113
  101. package/src/Brand.ts +14 -6
  102. package/src/Cause.ts +1 -0
  103. package/src/Chunk.ts +97 -95
  104. package/src/Config.ts +2 -1
  105. package/src/Context.ts +4 -4
  106. package/src/Effect.ts +2107 -1621
  107. package/src/Either.ts +34 -34
  108. package/src/LogLevel.ts +3 -3
  109. package/src/Logger.ts +16 -16
  110. package/src/Match.ts +26 -26
  111. package/src/Option.ts +84 -84
  112. package/src/Predicate.ts +4 -0
  113. package/src/Schema.ts +87 -41
  114. package/src/SchemaAST.ts +47 -22
  115. package/src/Scope.ts +2 -0
  116. package/src/Stream.ts +229 -229
  117. package/src/internal/core.ts +2 -1
  118. package/src/internal/schema/util.ts +34 -25
  119. package/src/internal/version.ts +1 -1
package/src/Array.ts CHANGED
@@ -4,21 +4,18 @@
4
4
  * @since 2.0.0
5
5
  */
6
6
 
7
- import type { Either } from "./Either.js"
8
- import * as E from "./Either.js"
7
+ import * as Either from "./Either.js"
9
8
  import * as Equal from "./Equal.js"
10
9
  import * as Equivalence from "./Equivalence.js"
11
10
  import type { LazyArg } from "./Function.js"
12
11
  import { dual, identity } from "./Function.js"
13
12
  import type { TypeLambda } from "./HKT.js"
14
- import * as readonlyArray from "./internal/array.js"
15
- import * as doNotation from "./internal/doNotation.js"
16
- import * as EffectIterable from "./Iterable.js"
17
- import type { Option } from "./Option.js"
18
- import * as O from "./Option.js"
13
+ import * as internalArray from "./internal/array.js"
14
+ import * as internalDoNotation from "./internal/doNotation.js"
15
+ import * as moduleIterable from "./Iterable.js"
16
+ import * as Option from "./Option.js"
19
17
  import * as Order from "./Order.js"
20
- import type { Predicate, Refinement } from "./Predicate.js"
21
- import { isBoolean } from "./Predicate.js"
18
+ import * as Predicate from "./Predicate.js"
22
19
  import * as Record from "./Record.js"
23
20
  import * as Tuple from "./Tuple.js"
24
21
  import type { NoInfer } from "./Types.js"
@@ -286,7 +283,7 @@ export const fromRecord: <K extends string, A>(self: Readonly<Record<K, A>>) =>
286
283
  * @category conversions
287
284
  * @since 2.0.0
288
285
  */
289
- export const fromOption: <A>(self: Option<A>) => Array<A> = O.toArray
286
+ export const fromOption: <A>(self: Option.Option<A>) => Array<A> = Option.toArray
290
287
 
291
288
  /**
292
289
  * Matches the elements of an array, applying functions to cases of empty and non-empty arrays.
@@ -1010,7 +1007,7 @@ export const isEmptyReadonlyArray: <A>(self: ReadonlyArray<A>) => self is readon
1010
1007
  * @category guards
1011
1008
  * @since 2.0.0
1012
1009
  */
1013
- export const isNonEmptyArray: <A>(self: Array<A>) => self is NonEmptyArray<A> = readonlyArray.isNonEmptyArray
1010
+ export const isNonEmptyArray: <A>(self: Array<A>) => self is NonEmptyArray<A> = internalArray.isNonEmptyArray
1014
1011
 
1015
1012
  /**
1016
1013
  * Determine if a `ReadonlyArray` is non empty narrowing down the type to `NonEmptyReadonlyArray`.
@@ -1030,7 +1027,7 @@ export const isNonEmptyArray: <A>(self: Array<A>) => self is NonEmptyArray<A> =
1030
1027
  * @since 2.0.0
1031
1028
  */
1032
1029
  export const isNonEmptyReadonlyArray: <A>(self: ReadonlyArray<A>) => self is NonEmptyReadonlyArray<A> =
1033
- readonlyArray.isNonEmptyArray
1030
+ internalArray.isNonEmptyArray
1034
1031
 
1035
1032
  /**
1036
1033
  * Return the number of elements in a `ReadonlyArray`.
@@ -1040,7 +1037,7 @@ export const isNonEmptyReadonlyArray: <A>(self: ReadonlyArray<A>) => self is Non
1040
1037
  */
1041
1038
  export const length = <A>(self: ReadonlyArray<A>): number => self.length
1042
1039
 
1043
- const isOutOfBound = <A>(i: number, as: ReadonlyArray<A>): boolean => i < 0 || i >= as.length
1040
+ const isOutOfBounds = <A>(i: number, as: ReadonlyArray<A>): boolean => i < 0 || i >= as.length
1044
1041
 
1045
1042
  const clamp = <A>(i: number, as: ReadonlyArray<A>): number => Math.floor(Math.min(Math.max(0, i), as.length))
1046
1043
 
@@ -1057,17 +1054,17 @@ export const get: {
1057
1054
  * @category getters
1058
1055
  * @since 2.0.0
1059
1056
  */
1060
- (index: number): <A>(self: ReadonlyArray<A>) => Option<A>
1057
+ (index: number): <A>(self: ReadonlyArray<A>) => Option.Option<A>
1061
1058
  /**
1062
1059
  * This function provides a safe way to read a value at a particular index from a `ReadonlyArray`.
1063
1060
  *
1064
1061
  * @category getters
1065
1062
  * @since 2.0.0
1066
1063
  */
1067
- <A>(self: ReadonlyArray<A>, index: number): Option<A>
1068
- } = dual(2, <A>(self: ReadonlyArray<A>, index: number): Option<A> => {
1064
+ <A>(self: ReadonlyArray<A>, index: number): Option.Option<A>
1065
+ } = dual(2, <A>(self: ReadonlyArray<A>, index: number): Option.Option<A> => {
1069
1066
  const i = Math.floor(index)
1070
- return isOutOfBound(i, self) ? O.none() : O.some(self[i])
1067
+ return isOutOfBounds(i, self) ? Option.none() : Option.some(self[i])
1071
1068
  })
1072
1069
 
1073
1070
  /**
@@ -1093,7 +1090,7 @@ export const unsafeGet: {
1093
1090
  <A>(self: ReadonlyArray<A>, index: number): A
1094
1091
  } = dual(2, <A>(self: ReadonlyArray<A>, index: number): A => {
1095
1092
  const i = Math.floor(index)
1096
- if (isOutOfBound(i, self)) {
1093
+ if (isOutOfBounds(i, self)) {
1097
1094
  throw new Error(`Index ${i} out of bounds`)
1098
1095
  }
1099
1096
  return self[i]
@@ -1143,7 +1140,7 @@ export const unappend = <A>(
1143
1140
  * @category getters
1144
1141
  * @since 2.0.0
1145
1142
  */
1146
- export const head: <A>(self: ReadonlyArray<A>) => Option<A> = get(0)
1143
+ export const head: <A>(self: ReadonlyArray<A>) => Option.Option<A> = get(0)
1147
1144
 
1148
1145
  /**
1149
1146
  * Get the first element of a non empty array.
@@ -1168,8 +1165,8 @@ export const headNonEmpty: <A>(self: NonEmptyReadonlyArray<A>) => A = unsafeGet(
1168
1165
  * @category getters
1169
1166
  * @since 2.0.0
1170
1167
  */
1171
- export const last = <A>(self: ReadonlyArray<A>): Option<A> =>
1172
- isNonEmptyReadonlyArray(self) ? O.some(lastNonEmpty(self)) : O.none()
1168
+ export const last = <A>(self: ReadonlyArray<A>): Option.Option<A> =>
1169
+ isNonEmptyReadonlyArray(self) ? Option.some(lastNonEmpty(self)) : Option.none()
1173
1170
 
1174
1171
  /**
1175
1172
  * Get the last element of a non empty array.
@@ -1194,9 +1191,9 @@ export const lastNonEmpty = <A>(self: NonEmptyReadonlyArray<A>): A => self[self.
1194
1191
  * @category getters
1195
1192
  * @since 2.0.0
1196
1193
  */
1197
- export const tail = <A>(self: Iterable<A>): Option<Array<A>> => {
1194
+ export const tail = <A>(self: Iterable<A>): Option.Option<Array<A>> => {
1198
1195
  const input = fromIterable(self)
1199
- return isNonEmptyReadonlyArray(input) ? O.some(tailNonEmpty(input)) : O.none()
1196
+ return isNonEmptyReadonlyArray(input) ? Option.some(tailNonEmpty(input)) : Option.none()
1200
1197
  }
1201
1198
 
1202
1199
  /**
@@ -1222,9 +1219,9 @@ export const tailNonEmpty = <A>(self: NonEmptyReadonlyArray<A>): Array<A> => sel
1222
1219
  * @category getters
1223
1220
  * @since 2.0.0
1224
1221
  */
1225
- export const init = <A>(self: Iterable<A>): Option<Array<A>> => {
1222
+ export const init = <A>(self: Iterable<A>): Option.Option<Array<A>> => {
1226
1223
  const input = fromIterable(self)
1227
- return isNonEmptyReadonlyArray(input) ? O.some(initNonEmpty(input)) : O.none()
1224
+ return isNonEmptyReadonlyArray(input) ? Option.some(initNonEmpty(input)) : Option.none()
1228
1225
  }
1229
1226
 
1230
1227
  /**
@@ -1756,7 +1753,7 @@ export const findFirstIndex: {
1756
1753
  * @category elements
1757
1754
  * @since 2.0.0
1758
1755
  */
1759
- <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option<number>
1756
+ <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option.Option<number>
1760
1757
  /**
1761
1758
  * Return the first index for which a predicate holds.
1762
1759
  *
@@ -1772,16 +1769,16 @@ export const findFirstIndex: {
1772
1769
  * @category elements
1773
1770
  * @since 2.0.0
1774
1771
  */
1775
- <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option<number>
1776
- } = dual(2, <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option<number> => {
1772
+ <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option.Option<number>
1773
+ } = dual(2, <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option.Option<number> => {
1777
1774
  let i = 0
1778
1775
  for (const a of self) {
1779
1776
  if (predicate(a, i)) {
1780
- return O.some(i)
1777
+ return Option.some(i)
1781
1778
  }
1782
1779
  i++
1783
1780
  }
1784
- return O.none()
1781
+ return Option.none()
1785
1782
  })
1786
1783
 
1787
1784
  /**
@@ -1815,7 +1812,7 @@ export const findLastIndex: {
1815
1812
  * @category elements
1816
1813
  * @since 2.0.0
1817
1814
  */
1818
- <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option<number>
1815
+ <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option.Option<number>
1819
1816
  /**
1820
1817
  * Return the last index for which a predicate holds.
1821
1818
  *
@@ -1831,15 +1828,15 @@ export const findLastIndex: {
1831
1828
  * @category elements
1832
1829
  * @since 2.0.0
1833
1830
  */
1834
- <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option<number>
1835
- } = dual(2, <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option<number> => {
1831
+ <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option.Option<number>
1832
+ } = dual(2, <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option.Option<number> => {
1836
1833
  const input = fromIterable(self)
1837
1834
  for (let i = input.length - 1; i >= 0; i--) {
1838
1835
  if (predicate(input[i], i)) {
1839
- return O.some(i)
1836
+ return Option.some(i)
1840
1837
  }
1841
1838
  }
1842
- return O.none()
1839
+ return Option.none()
1843
1840
  })
1844
1841
 
1845
1842
  /**
@@ -1875,7 +1872,7 @@ export const findFirst: {
1875
1872
  * @category elements
1876
1873
  * @since 2.0.0
1877
1874
  */
1878
- <A, B>(f: (a: NoInfer<A>, i: number) => Option<B>): (self: Iterable<A>) => Option<B>
1875
+ <A, B>(f: (a: NoInfer<A>, i: number) => Option.Option<B>): (self: Iterable<A>) => Option.Option<B>
1879
1876
  /**
1880
1877
  * Returns the first element that satisfies the specified
1881
1878
  * predicate, or `None` if no such element exists.
@@ -1892,7 +1889,7 @@ export const findFirst: {
1892
1889
  * @category elements
1893
1890
  * @since 2.0.0
1894
1891
  */
1895
- <A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Option<B>
1892
+ <A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Option.Option<B>
1896
1893
  /**
1897
1894
  * Returns the first element that satisfies the specified
1898
1895
  * predicate, or `None` if no such element exists.
@@ -1909,7 +1906,7 @@ export const findFirst: {
1909
1906
  * @category elements
1910
1907
  * @since 2.0.0
1911
1908
  */
1912
- <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option<A>
1909
+ <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option.Option<A>
1913
1910
  /**
1914
1911
  * Returns the first element that satisfies the specified
1915
1912
  * predicate, or `None` if no such element exists.
@@ -1926,7 +1923,7 @@ export const findFirst: {
1926
1923
  * @category elements
1927
1924
  * @since 2.0.0
1928
1925
  */
1929
- <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option<B>): Option<B>
1926
+ <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option.Option<B>): Option.Option<B>
1930
1927
  /**
1931
1928
  * Returns the first element that satisfies the specified
1932
1929
  * predicate, or `None` if no such element exists.
@@ -1943,7 +1940,7 @@ export const findFirst: {
1943
1940
  * @category elements
1944
1941
  * @since 2.0.0
1945
1942
  */
1946
- <A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Option<B>
1943
+ <A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Option.Option<B>
1947
1944
  /**
1948
1945
  * Returns the first element that satisfies the specified
1949
1946
  * predicate, or `None` if no such element exists.
@@ -1960,8 +1957,8 @@ export const findFirst: {
1960
1957
  * @category elements
1961
1958
  * @since 2.0.0
1962
1959
  */
1963
- <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option<A>
1964
- } = EffectIterable.findFirst
1960
+ <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option.Option<A>
1961
+ } = moduleIterable.findFirst
1965
1962
 
1966
1963
  /**
1967
1964
  * Finds the last element in an iterable collection that satisfies the given predicate or refinement.
@@ -1996,7 +1993,7 @@ export const findLast: {
1996
1993
  * @category elements
1997
1994
  * @since 2.0.0
1998
1995
  */
1999
- <A, B>(f: (a: NoInfer<A>, i: number) => Option<B>): (self: Iterable<A>) => Option<B>
1996
+ <A, B>(f: (a: NoInfer<A>, i: number) => Option.Option<B>): (self: Iterable<A>) => Option.Option<B>
2000
1997
  /**
2001
1998
  * Finds the last element in an iterable collection that satisfies the given predicate or refinement.
2002
1999
  * Returns an `Option` containing the found element, or `Option.none` if no element matches.
@@ -2013,7 +2010,7 @@ export const findLast: {
2013
2010
  * @category elements
2014
2011
  * @since 2.0.0
2015
2012
  */
2016
- <A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Option<B>
2013
+ <A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Option.Option<B>
2017
2014
  /**
2018
2015
  * Finds the last element in an iterable collection that satisfies the given predicate or refinement.
2019
2016
  * Returns an `Option` containing the found element, or `Option.none` if no element matches.
@@ -2030,7 +2027,7 @@ export const findLast: {
2030
2027
  * @category elements
2031
2028
  * @since 2.0.0
2032
2029
  */
2033
- <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option<A>
2030
+ <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option.Option<A>
2034
2031
  /**
2035
2032
  * Finds the last element in an iterable collection that satisfies the given predicate or refinement.
2036
2033
  * Returns an `Option` containing the found element, or `Option.none` if no element matches.
@@ -2047,7 +2044,7 @@ export const findLast: {
2047
2044
  * @category elements
2048
2045
  * @since 2.0.0
2049
2046
  */
2050
- <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option<B>): Option<B>
2047
+ <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option.Option<B>): Option.Option<B>
2051
2048
  /**
2052
2049
  * Finds the last element in an iterable collection that satisfies the given predicate or refinement.
2053
2050
  * Returns an `Option` containing the found element, or `Option.none` if no element matches.
@@ -2064,7 +2061,7 @@ export const findLast: {
2064
2061
  * @category elements
2065
2062
  * @since 2.0.0
2066
2063
  */
2067
- <A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Option<B>
2064
+ <A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Option.Option<B>
2068
2065
  /**
2069
2066
  * Finds the last element in an iterable collection that satisfies the given predicate or refinement.
2070
2067
  * Returns an `Option` containing the found element, or `Option.none` if no element matches.
@@ -2081,25 +2078,28 @@ export const findLast: {
2081
2078
  * @category elements
2082
2079
  * @since 2.0.0
2083
2080
  */
2084
- <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option<A>
2081
+ <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option.Option<A>
2085
2082
  } = dual(
2086
2083
  2,
2087
- <A>(self: Iterable<A>, f: ((a: A, i: number) => boolean) | ((a: A, i: number) => Option<A>)): Option<A> => {
2084
+ <A>(
2085
+ self: Iterable<A>,
2086
+ f: ((a: A, i: number) => boolean) | ((a: A, i: number) => Option.Option<A>)
2087
+ ): Option.Option<A> => {
2088
2088
  const input = fromIterable(self)
2089
2089
  for (let i = input.length - 1; i >= 0; i--) {
2090
2090
  const a = input[i]
2091
2091
  const o = f(a, i)
2092
- if (isBoolean(o)) {
2092
+ if (Predicate.isBoolean(o)) {
2093
2093
  if (o) {
2094
- return O.some(a)
2094
+ return Option.some(a)
2095
2095
  }
2096
2096
  } else {
2097
- if (O.isSome(o)) {
2097
+ if (Option.isSome(o)) {
2098
2098
  return o
2099
2099
  }
2100
2100
  }
2101
2101
  }
2102
- return O.none()
2102
+ return Option.none()
2103
2103
  }
2104
2104
  )
2105
2105
 
@@ -2134,7 +2134,7 @@ export const insertAt: {
2134
2134
  *
2135
2135
  * @since 2.0.0
2136
2136
  */
2137
- <B>(i: number, b: B): <A>(self: Iterable<A>) => Option<NonEmptyArray<A | B>>
2137
+ <B>(i: number, b: B): <A>(self: Iterable<A>) => Option.Option<NonEmptyArray<A | B>>
2138
2138
  /**
2139
2139
  * Insert an element at the specified index, creating a new `NonEmptyArray`,
2140
2140
  * or return `None` if the index is out of bounds.
@@ -2150,15 +2150,15 @@ export const insertAt: {
2150
2150
  *
2151
2151
  * @since 2.0.0
2152
2152
  */
2153
- <A, B>(self: Iterable<A>, i: number, b: B): Option<NonEmptyArray<A | B>>
2154
- } = dual(3, <A, B>(self: Iterable<A>, i: number, b: B): Option<NonEmptyArray<A | B>> => {
2153
+ <A, B>(self: Iterable<A>, i: number, b: B): Option.Option<NonEmptyArray<A | B>>
2154
+ } = dual(3, <A, B>(self: Iterable<A>, i: number, b: B): Option.Option<NonEmptyArray<A | B>> => {
2155
2155
  const out: Array<A | B> = Array.from(self)
2156
2156
  // v--- `= self.length` is ok, it means inserting in last position
2157
2157
  if (i < 0 || i > out.length) {
2158
- return O.none()
2158
+ return Option.none()
2159
2159
  }
2160
2160
  out.splice(i, 0, b)
2161
- return O.some(out) as any
2161
+ return Option.some(out) as any
2162
2162
  })
2163
2163
 
2164
2164
  /**
@@ -2242,7 +2242,9 @@ export const replaceOption: {
2242
2242
  *
2243
2243
  * @since 2.0.0
2244
2244
  */
2245
- <B>(i: number, b: B): <A, S extends Iterable<A> = Iterable<A>>(self: S) => Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>
2245
+ <B>(i: number, b: B): <A, S extends Iterable<A> = Iterable<A>>(
2246
+ self: S
2247
+ ) => Option.Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>
2246
2248
  /**
2247
2249
  * Replaces an element in an array with the given value, returning an option of the updated array.
2248
2250
  *
@@ -2257,10 +2259,10 @@ export const replaceOption: {
2257
2259
  *
2258
2260
  * @since 2.0.0
2259
2261
  */
2260
- <A, B, S extends Iterable<A> = Iterable<A>>(self: S, i: number, b: B): Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>
2262
+ <A, B, S extends Iterable<A> = Iterable<A>>(self: S, i: number, b: B): Option.Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>
2261
2263
  } = dual(
2262
2264
  3,
2263
- <A, B>(self: Iterable<A>, i: number, b: B): Option<Array<A | B>> => modifyOption(self, i, () => b)
2265
+ <A, B>(self: Iterable<A>, i: number, b: B): Option.Option<Array<A | B>> => modifyOption(self, i, () => b)
2264
2266
  )
2265
2267
 
2266
2268
  /**
@@ -2314,7 +2316,7 @@ export const modify: {
2314
2316
  } = dual(
2315
2317
  3,
2316
2318
  <A, B>(self: Iterable<A>, i: number, f: (a: A) => B): Array<A | B> =>
2317
- O.getOrElse(modifyOption(self, i, f), () => Array.from(self))
2319
+ Option.getOrElse(modifyOption(self, i, f), () => Array.from(self))
2318
2320
  )
2319
2321
 
2320
2322
  /**
@@ -2356,7 +2358,7 @@ export const modifyOption: {
2356
2358
  *
2357
2359
  * @since 2.0.0
2358
2360
  */
2359
- <A, B, S extends Iterable<A> = Iterable<A>>(i: number, f: (a: ReadonlyArray.Infer<S>) => B): (self: S) => Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>
2361
+ <A, B, S extends Iterable<A> = Iterable<A>>(i: number, f: (a: ReadonlyArray.Infer<S>) => B): (self: S) => Option.Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>
2360
2362
  /**
2361
2363
  * Apply a function to the element at the specified index, creating a new `Array`,
2362
2364
  * or return `None` if the index is out of bounds.
@@ -2376,16 +2378,16 @@ export const modifyOption: {
2376
2378
  *
2377
2379
  * @since 2.0.0
2378
2380
  */
2379
- <A, B, S extends Iterable<A> = Iterable<A>>(self: S, i: number, f: (a: ReadonlyArray.Infer<S>) => B): Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>
2380
- } = dual(3, <A, B>(self: Iterable<A>, i: number, f: (a: A) => B): Option<Array<A | B>> => {
2381
- const out = Array.from(self)
2382
- if (isOutOfBound(i, out)) {
2383
- return O.none()
2381
+ <A, B, S extends Iterable<A> = Iterable<A>>(self: S, i: number, f: (a: ReadonlyArray.Infer<S>) => B): Option.Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>
2382
+ } = dual(3, <A, B>(self: Iterable<A>, i: number, f: (a: A) => B): Option.Option<Array<A | B>> => {
2383
+ const arr = Array.from(self)
2384
+ if (isOutOfBounds(i, arr)) {
2385
+ return Option.none()
2384
2386
  }
2385
- const next = f(out[i])
2386
- // @ts-expect-error
2387
- out[i] = next
2388
- return O.some(out)
2387
+ const out: Array<A | B> = arr
2388
+ const b = f(arr[i])
2389
+ out[i] = b
2390
+ return Option.some(out)
2389
2391
  })
2390
2392
 
2391
2393
  /**
@@ -2450,7 +2452,7 @@ export const remove: {
2450
2452
  <A>(self: Iterable<A>, i: number): Array<A>
2451
2453
  } = dual(2, <A>(self: Iterable<A>, i: number): Array<A> => {
2452
2454
  const out = Array.from(self)
2453
- if (isOutOfBound(i, out)) {
2455
+ if (isOutOfBounds(i, out)) {
2454
2456
  return out
2455
2457
  }
2456
2458
  out.splice(i, 1)
@@ -3250,7 +3252,7 @@ export const rotate: {
3250
3252
  if (isNonEmptyReadonlyArray(input)) {
3251
3253
  const len = input.length
3252
3254
  const m = Math.round(n) % len
3253
- if (isOutOfBound(Math.abs(m), input) || m === 0) {
3255
+ if (isOutOfBounds(Math.abs(m), input) || m === 0) {
3254
3256
  return copy(input)
3255
3257
  }
3256
3258
  if (m < 0) {
@@ -3450,7 +3452,7 @@ export const chop: {
3450
3452
  const [b, rest] = f(input)
3451
3453
  const out: NonEmptyArray<B> = [b]
3452
3454
  let next: ReadonlyArray<A> = rest
3453
- while (readonlyArray.isNonEmptyArray(next)) {
3455
+ while (internalArray.isNonEmptyArray(next)) {
3454
3456
  const [b, rest] = f(next)
3455
3457
  out.push(b)
3456
3458
  next = rest
@@ -4644,7 +4646,7 @@ export const filterMap: {
4644
4646
  * @category filtering
4645
4647
  * @since 2.0.0
4646
4648
  */
4647
- <A, B>(f: (a: A, i: number) => Option<B>): (self: Iterable<A>) => Array<B>
4649
+ <A, B>(f: (a: A, i: number) => Option.Option<B>): (self: Iterable<A>) => Array<B>
4648
4650
  /**
4649
4651
  * Applies a function to each element of the `Iterable` and filters based on the result, keeping the transformed values where the function returns `Some`.
4650
4652
  * This method combines filtering and mapping functionalities, allowing transformations and filtering of elements based on a single function pass.
@@ -4663,15 +4665,15 @@ export const filterMap: {
4663
4665
  * @category filtering
4664
4666
  * @since 2.0.0
4665
4667
  */
4666
- <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option<B>): Array<B>
4668
+ <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option.Option<B>): Array<B>
4667
4669
  } = dual(
4668
4670
  2,
4669
- <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option<B>): Array<B> => {
4671
+ <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option.Option<B>): Array<B> => {
4670
4672
  const as = fromIterable(self)
4671
4673
  const out: Array<B> = []
4672
4674
  for (let i = 0; i < as.length; i++) {
4673
4675
  const o = f(as[i], i)
4674
- if (O.isSome(o)) {
4676
+ if (Option.isSome(o)) {
4675
4677
  out.push(o.value)
4676
4678
  }
4677
4679
  }
@@ -4718,7 +4720,7 @@ export const filterMapWhile: {
4718
4720
  * @category filtering
4719
4721
  * @since 2.0.0
4720
4722
  */
4721
- <A, B>(f: (a: A, i: number) => Option<B>): (self: Iterable<A>) => Array<B>
4723
+ <A, B>(f: (a: A, i: number) => Option.Option<B>): (self: Iterable<A>) => Array<B>
4722
4724
  /**
4723
4725
  * Applies a function to each element of the array and filters based on the result, stopping when a condition is not met.
4724
4726
  * This method combines filtering and mapping in a single pass, and short-circuits, i.e., stops processing, as soon as the function returns `None`.
@@ -4738,13 +4740,13 @@ export const filterMapWhile: {
4738
4740
  * @category filtering
4739
4741
  * @since 2.0.0
4740
4742
  */
4741
- <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option<B>): Array<B>
4742
- } = dual(2, <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option<B>) => {
4743
+ <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option.Option<B>): Array<B>
4744
+ } = dual(2, <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option.Option<B>) => {
4743
4745
  let i = 0
4744
4746
  const out: Array<B> = []
4745
4747
  for (const a of self) {
4746
4748
  const b = f(a, i)
4747
- if (O.isSome(b)) {
4749
+ if (Option.isSome(b)) {
4748
4750
  out.push(b.value)
4749
4751
  } else {
4750
4752
  break
@@ -4807,7 +4809,7 @@ export const partitionMap: {
4807
4809
  * @category filtering
4808
4810
  * @since 2.0.0
4809
4811
  */
4810
- <A, B, C>(f: (a: A, i: number) => Either<C, B>): (self: Iterable<A>) => [left: Array<B>, right: Array<C>]
4812
+ <A, B, C>(f: (a: A, i: number) => Either.Either<C, B>): (self: Iterable<A>) => [left: Array<B>, right: Array<C>]
4811
4813
  /**
4812
4814
  * Applies a function to each element of the `Iterable`, categorizing the results into two separate arrays.
4813
4815
  * This function is particularly useful for operations where each element can result in two possible types,
@@ -4834,16 +4836,16 @@ export const partitionMap: {
4834
4836
  * @category filtering
4835
4837
  * @since 2.0.0
4836
4838
  */
4837
- <A, B, C>(self: Iterable<A>, f: (a: A, i: number) => Either<C, B>): [left: Array<B>, right: Array<C>]
4839
+ <A, B, C>(self: Iterable<A>, f: (a: A, i: number) => Either.Either<C, B>): [left: Array<B>, right: Array<C>]
4838
4840
  } = dual(
4839
4841
  2,
4840
- <A, B, C>(self: Iterable<A>, f: (a: A, i: number) => Either<C, B>): [left: Array<B>, right: Array<C>] => {
4842
+ <A, B, C>(self: Iterable<A>, f: (a: A, i: number) => Either.Either<C, B>): [left: Array<B>, right: Array<C>] => {
4841
4843
  const left: Array<B> = []
4842
4844
  const right: Array<C> = []
4843
4845
  const as = fromIterable(self)
4844
4846
  for (let i = 0; i < as.length; i++) {
4845
4847
  const e = f(as[i], i)
4846
- if (E.isLeft(e)) {
4848
+ if (Either.isLeft(e)) {
4847
4849
  left.push(e.left)
4848
4850
  } else {
4849
4851
  right.push(e.right)
@@ -4869,9 +4871,9 @@ export const partitionMap: {
4869
4871
  * @since 2.0.0
4870
4872
  */
4871
4873
 
4872
- export const getSomes: <T extends Iterable<Option<X>>, X = any>(
4874
+ export const getSomes: <T extends Iterable<Option.Option<X>>, X = any>(
4873
4875
  self: T
4874
- ) => Array<Option.Value<ReadonlyArray.Infer<T>>> = filterMap(identity as any)
4876
+ ) => Array<Option.Option.Value<ReadonlyArray.Infer<T>>> = filterMap(identity as any)
4875
4877
 
4876
4878
  /**
4877
4879
  * Retrieves the `Left` values from an `Iterable` of `Either`s, collecting them into an array.
@@ -4888,10 +4890,12 @@ export const getSomes: <T extends Iterable<Option<X>>, X = any>(
4888
4890
  * @category filtering
4889
4891
  * @since 2.0.0
4890
4892
  */
4891
- export const getLefts = <T extends Iterable<Either<any, any>>>(self: T): Array<Either.Left<ReadonlyArray.Infer<T>>> => {
4893
+ export const getLefts = <T extends Iterable<Either.Either<any, any>>>(
4894
+ self: T
4895
+ ): Array<Either.Either.Left<ReadonlyArray.Infer<T>>> => {
4892
4896
  const out: Array<any> = []
4893
4897
  for (const a of self) {
4894
- if (E.isLeft(a)) {
4898
+ if (Either.isLeft(a)) {
4895
4899
  out.push(a.left)
4896
4900
  }
4897
4901
  }
@@ -4914,12 +4918,12 @@ export const getLefts = <T extends Iterable<Either<any, any>>>(self: T): Array<E
4914
4918
  * @category filtering
4915
4919
  * @since 2.0.0
4916
4920
  */
4917
- export const getRights = <T extends Iterable<Either<any, any>>>(
4921
+ export const getRights = <T extends Iterable<Either.Either<any, any>>>(
4918
4922
  self: T
4919
- ): Array<Either.Right<ReadonlyArray.Infer<T>>> => {
4923
+ ): Array<Either.Either.Right<ReadonlyArray.Infer<T>>> => {
4920
4924
  const out: Array<any> = []
4921
4925
  for (const a of self) {
4922
- if (E.isRight(a)) {
4926
+ if (Either.isRight(a)) {
4923
4927
  out.push(a.right)
4924
4928
  }
4925
4929
  }
@@ -5071,11 +5075,10 @@ export const partition: {
5071
5075
  * @category filtering
5072
5076
  * @since 2.0.0
5073
5077
  */
5074
- export const separate: <T extends Iterable<Either<any, any>>>(
5078
+ export const separate: <T extends Iterable<Either.Either<any, any>>>(
5075
5079
  self: T
5076
- ) => [Array<Either.Left<ReadonlyArray.Infer<T>>>, Array<Either.Right<ReadonlyArray.Infer<T>>>] = partitionMap(
5077
- identity
5078
- )
5080
+ ) => [Array<Either.Either.Left<ReadonlyArray.Infer<T>>>, Array<Either.Either.Right<ReadonlyArray.Infer<T>>>] =
5081
+ partitionMap(identity)
5079
5082
 
5080
5083
  /**
5081
5084
  * Reduces an array from the left.
@@ -5203,7 +5206,7 @@ export const reduceRight: {
5203
5206
  * @since 2.0.0
5204
5207
  */
5205
5208
  export const liftPredicate: { // Note: I intentionally avoid using the NoInfer pattern here.
5206
- <A, B extends A>(refinement: Refinement<A, B>): (a: A) => Array<B>
5209
+ <A, B extends A>(refinement: Predicate.Refinement<A, B>): (a: A) => Array<B>
5207
5210
  /**
5208
5211
  * Lifts a predicate into an array.
5209
5212
  *
@@ -5221,15 +5224,15 @@ export const liftPredicate: { // Note: I intentionally avoid using the NoInfer p
5221
5224
  * @category lifting
5222
5225
  * @since 2.0.0
5223
5226
  */
5224
- <A>(predicate: Predicate<A>): <B extends A>(b: B) => Array<B>
5225
- } = <A>(predicate: Predicate<A>) => <B extends A>(b: B): Array<B> => predicate(b) ? [b] : []
5227
+ <A>(predicate: Predicate.Predicate<A>): <B extends A>(b: B) => Array<B>
5228
+ } = <A>(predicate: Predicate.Predicate<A>) => <B extends A>(b: B): Array<B> => predicate(b) ? [b] : []
5226
5229
 
5227
5230
  /**
5228
5231
  * @category lifting
5229
5232
  * @since 2.0.0
5230
5233
  */
5231
5234
  export const liftOption = <A extends Array<unknown>, B>(
5232
- f: (...a: A) => Option<B>
5235
+ f: (...a: A) => Option.Option<B>
5233
5236
  ) =>
5234
5237
  (...a: A): Array<B> => fromOption(f(...a))
5235
5238
 
@@ -5348,11 +5351,11 @@ export const flatMapNullable: {
5348
5351
  * @since 2.0.0
5349
5352
  */
5350
5353
  export const liftEither = <A extends Array<unknown>, E, B>(
5351
- f: (...a: A) => Either<B, E>
5354
+ f: (...a: A) => Either.Either<B, E>
5352
5355
  ) =>
5353
5356
  (...a: A): Array<B> => {
5354
5357
  const e = f(...a)
5355
- return E.isLeft(e) ? [] : [e.right]
5358
+ return Either.isLeft(e) ? [] : [e.right]
5356
5359
  }
5357
5360
 
5358
5361
  /**
@@ -5589,11 +5592,11 @@ export const max: {
5589
5592
  * @category constructors
5590
5593
  * @since 2.0.0
5591
5594
  */
5592
- export const unfold = <B, A>(b: B, f: (b: B) => Option<readonly [A, B]>): Array<A> => {
5595
+ export const unfold = <B, A>(b: B, f: (b: B) => Option.Option<readonly [A, B]>): Array<A> => {
5593
5596
  const out: Array<A> = []
5594
5597
  let next: B = b
5595
- let o: Option<readonly [A, B]>
5596
- while (O.isSome(o = f(next))) {
5598
+ let o: Option.Option<readonly [A, B]>
5599
+ while (Option.isSome(o = f(next))) {
5597
5600
  const [a, b] = o.value
5598
5601
  out.push(a)
5599
5602
  next = b
@@ -5820,11 +5823,11 @@ export const dedupeAdjacentWith: {
5820
5823
  <A>(self: Iterable<A>, isEquivalent: (self: A, that: A) => boolean): Array<A>
5821
5824
  } = dual(2, <A>(self: Iterable<A>, isEquivalent: (self: A, that: A) => boolean): Array<A> => {
5822
5825
  const out: Array<A> = []
5823
- let lastA: O.Option<A> = O.none()
5826
+ let lastA: Option.Option<A> = Option.none()
5824
5827
  for (const a of self) {
5825
- if (O.isNone(lastA) || !isEquivalent(a, lastA.value)) {
5828
+ if (Option.isNone(lastA) || !isEquivalent(a, lastA.value)) {
5826
5829
  out.push(a)
5827
- lastA = O.some(a)
5830
+ lastA = Option.some(a)
5828
5831
  }
5829
5832
  }
5830
5833
  return out
@@ -6277,7 +6280,7 @@ export const bind: {
6277
6280
  tag: Exclude<N, keyof A>,
6278
6281
  f: (a: NoInfer<A>) => ReadonlyArray<B>
6279
6282
  ): Array<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }>
6280
- } = doNotation.bind<ReadonlyArrayTypeLambda>(map, flatMap) as any
6283
+ } = internalDoNotation.bind<ReadonlyArrayTypeLambda>(map, flatMap) as any
6281
6284
 
6282
6285
  /**
6283
6286
  * The "do simulation" for array allows you to sequentially apply operations to the elements of arrays, just as nested loops allow you to go through all combinations of elements in an arrays.
@@ -6423,7 +6426,7 @@ export const bindTo: {
6423
6426
  * @since 3.2.0
6424
6427
  */
6425
6428
  <A, N extends string>(self: ReadonlyArray<A>, tag: N): Array<{ [K in N]: A }>
6426
- } = doNotation.bindTo<ReadonlyArrayTypeLambda>(map) as any
6429
+ } = internalDoNotation.bindTo<ReadonlyArrayTypeLambda>(map) as any
6427
6430
 
6428
6431
  const let_: {
6429
6432
  <N extends string, B, A extends object>(
@@ -6435,7 +6438,7 @@ const let_: {
6435
6438
  tag: Exclude<N, keyof A>,
6436
6439
  f: (a: NoInfer<A>) => B
6437
6440
  ): Array<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }>
6438
- } = doNotation.let_<ReadonlyArrayTypeLambda>(map) as any
6441
+ } = internalDoNotation.let_<ReadonlyArrayTypeLambda>(map) as any
6439
6442
 
6440
6443
  export {
6441
6444
  /**