effect 3.8.4 → 3.8.5

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 (595) hide show
  1. package/dist/cjs/Array.js.map +1 -1
  2. package/dist/cjs/BigDecimal.js +2 -3
  3. package/dist/cjs/BigDecimal.js.map +1 -1
  4. package/dist/cjs/BigInt.js.map +1 -1
  5. package/dist/cjs/Boolean.js.map +1 -1
  6. package/dist/cjs/Cause.js.map +1 -1
  7. package/dist/cjs/Channel.js.map +1 -1
  8. package/dist/cjs/ChildExecutorDecision.js.map +1 -1
  9. package/dist/cjs/Chunk.js.map +1 -1
  10. package/dist/cjs/Config.js.map +1 -1
  11. package/dist/cjs/ConfigError.js.map +1 -1
  12. package/dist/cjs/ConfigProvider.js.map +1 -1
  13. package/dist/cjs/ConfigProviderPathPatch.js.map +1 -1
  14. package/dist/cjs/Console.js.map +1 -1
  15. package/dist/cjs/Context.js.map +1 -1
  16. package/dist/cjs/Cron.js.map +1 -1
  17. package/dist/cjs/Data.js.map +1 -1
  18. package/dist/cjs/DateTime.js.map +1 -1
  19. package/dist/cjs/Deferred.js.map +1 -1
  20. package/dist/cjs/Differ.js.map +1 -1
  21. package/dist/cjs/Duration.js.map +1 -1
  22. package/dist/cjs/Effect.js.map +1 -1
  23. package/dist/cjs/Either.js.map +1 -1
  24. package/dist/cjs/Equivalence.js.map +1 -1
  25. package/dist/cjs/ExecutionStrategy.js.map +1 -1
  26. package/dist/cjs/Exit.js.map +1 -1
  27. package/dist/cjs/Fiber.js.map +1 -1
  28. package/dist/cjs/FiberHandle.js.map +1 -1
  29. package/dist/cjs/FiberId.js.map +1 -1
  30. package/dist/cjs/FiberMap.js.map +1 -1
  31. package/dist/cjs/FiberRef.js.map +1 -1
  32. package/dist/cjs/FiberRefs.js.map +1 -1
  33. package/dist/cjs/FiberRefsPatch.js.map +1 -1
  34. package/dist/cjs/FiberSet.js.map +1 -1
  35. package/dist/cjs/Function.js.map +1 -1
  36. package/dist/cjs/GroupBy.js.map +1 -1
  37. package/dist/cjs/Hash.js.map +1 -1
  38. package/dist/cjs/HashMap.js.map +1 -1
  39. package/dist/cjs/HashSet.js.map +1 -1
  40. package/dist/cjs/Iterable.js.map +1 -1
  41. package/dist/cjs/KeyedPool.js.map +1 -1
  42. package/dist/cjs/Layer.js.map +1 -1
  43. package/dist/cjs/List.js.map +1 -1
  44. package/dist/cjs/LogLevel.js.map +1 -1
  45. package/dist/cjs/Logger.js.map +1 -1
  46. package/dist/cjs/Mailbox.js.map +1 -1
  47. package/dist/cjs/MergeDecision.js.map +1 -1
  48. package/dist/cjs/MergeState.js.map +1 -1
  49. package/dist/cjs/MergeStrategy.js.map +1 -1
  50. package/dist/cjs/Metric.js.map +1 -1
  51. package/dist/cjs/MetricHook.js.map +1 -1
  52. package/dist/cjs/MetricKey.js.map +1 -1
  53. package/dist/cjs/MetricPolling.js.map +1 -1
  54. package/dist/cjs/MetricState.js.map +1 -1
  55. package/dist/cjs/Micro.js.map +1 -1
  56. package/dist/cjs/MutableHashMap.js.map +1 -1
  57. package/dist/cjs/MutableHashSet.js.map +1 -1
  58. package/dist/cjs/MutableList.js.map +1 -1
  59. package/dist/cjs/MutableQueue.js.map +1 -1
  60. package/dist/cjs/MutableRef.js.map +1 -1
  61. package/dist/cjs/Number.js.map +1 -1
  62. package/dist/cjs/Option.js.map +1 -1
  63. package/dist/cjs/Order.js.map +1 -1
  64. package/dist/cjs/Ordering.js.map +1 -1
  65. package/dist/cjs/Pipeable.js.map +1 -1
  66. package/dist/cjs/Pool.js.map +1 -1
  67. package/dist/cjs/Predicate.js.map +1 -1
  68. package/dist/cjs/PubSub.js.map +1 -1
  69. package/dist/cjs/Queue.js.map +1 -1
  70. package/dist/cjs/RcMap.js.map +1 -1
  71. package/dist/cjs/Readable.js.map +1 -1
  72. package/dist/cjs/Record.js.map +1 -1
  73. package/dist/cjs/RedBlackTree.js.map +1 -1
  74. package/dist/cjs/Ref.js.map +1 -1
  75. package/dist/cjs/Request.js.map +1 -1
  76. package/dist/cjs/RequestResolver.js.map +1 -1
  77. package/dist/cjs/Runtime.js.map +1 -1
  78. package/dist/cjs/RuntimeFlags.js.map +1 -1
  79. package/dist/cjs/RuntimeFlagsPatch.js.map +1 -1
  80. package/dist/cjs/STM.js.map +1 -1
  81. package/dist/cjs/Schedule.js.map +1 -1
  82. package/dist/cjs/ScheduleInterval.js.map +1 -1
  83. package/dist/cjs/ScheduleIntervals.js.map +1 -1
  84. package/dist/cjs/Scheduler.js.map +1 -1
  85. package/dist/cjs/Scope.js.map +1 -1
  86. package/dist/cjs/ScopedRef.js.map +1 -1
  87. package/dist/cjs/Sink.js.map +1 -1
  88. package/dist/cjs/SortedMap.js.map +1 -1
  89. package/dist/cjs/SortedSet.js.map +1 -1
  90. package/dist/cjs/Stream.js +17 -3
  91. package/dist/cjs/Stream.js.map +1 -1
  92. package/dist/cjs/StreamHaltStrategy.js.map +1 -1
  93. package/dist/cjs/String.js.map +1 -1
  94. package/dist/cjs/Struct.js.map +1 -1
  95. package/dist/cjs/Subscribable.js.map +1 -1
  96. package/dist/cjs/SubscriptionRef.js.map +1 -1
  97. package/dist/cjs/SynchronizedRef.js.map +1 -1
  98. package/dist/cjs/TArray.js.map +1 -1
  99. package/dist/cjs/TDeferred.js.map +1 -1
  100. package/dist/cjs/TMap.js.map +1 -1
  101. package/dist/cjs/TPriorityQueue.js.map +1 -1
  102. package/dist/cjs/TPubSub.js.map +1 -1
  103. package/dist/cjs/TQueue.js.map +1 -1
  104. package/dist/cjs/TReentrantLock.js.map +1 -1
  105. package/dist/cjs/TRef.js.map +1 -1
  106. package/dist/cjs/TSemaphore.js.map +1 -1
  107. package/dist/cjs/TSet.js.map +1 -1
  108. package/dist/cjs/Take.js.map +1 -1
  109. package/dist/cjs/TestAnnotationMap.js.map +1 -1
  110. package/dist/cjs/TestClock.js.map +1 -1
  111. package/dist/cjs/TestServices.js.map +1 -1
  112. package/dist/cjs/Trie.js.map +1 -1
  113. package/dist/cjs/Tuple.js.map +1 -1
  114. package/dist/cjs/Unify.js.map +1 -1
  115. package/dist/cjs/UpstreamPullRequest.js.map +1 -1
  116. package/dist/cjs/UpstreamPullStrategy.js.map +1 -1
  117. package/dist/cjs/Utils.js +1 -14
  118. package/dist/cjs/Utils.js.map +1 -1
  119. package/dist/cjs/internal/core.js +4 -3
  120. package/dist/cjs/internal/core.js.map +1 -1
  121. package/dist/cjs/internal/runtime.js +1 -1
  122. package/dist/cjs/internal/runtime.js.map +1 -1
  123. package/dist/cjs/internal/stream.js +12 -3
  124. package/dist/cjs/internal/stream.js.map +1 -1
  125. package/dist/cjs/internal/version.js +1 -1
  126. package/dist/dts/Array.d.ts +2684 -0
  127. package/dist/dts/Array.d.ts.map +1 -1
  128. package/dist/dts/BigDecimal.d.ts +558 -1
  129. package/dist/dts/BigDecimal.d.ts.map +1 -1
  130. package/dist/dts/BigInt.d.ts +490 -0
  131. package/dist/dts/BigInt.d.ts.map +1 -1
  132. package/dist/dts/Boolean.d.ts +228 -0
  133. package/dist/dts/Boolean.d.ts.map +1 -1
  134. package/dist/dts/Cause.d.ts +172 -0
  135. package/dist/dts/Cause.d.ts.map +1 -1
  136. package/dist/dts/Channel.d.ts +750 -0
  137. package/dist/dts/Channel.d.ts.map +1 -1
  138. package/dist/dts/ChildExecutorDecision.d.ts +12 -0
  139. package/dist/dts/ChildExecutorDecision.d.ts.map +1 -1
  140. package/dist/dts/Chunk.d.ts +791 -0
  141. package/dist/dts/Chunk.d.ts.map +1 -1
  142. package/dist/dts/Config.d.ts +174 -0
  143. package/dist/dts/Config.d.ts.map +1 -1
  144. package/dist/dts/ConfigError.d.ts +16 -0
  145. package/dist/dts/ConfigError.d.ts.map +1 -1
  146. package/dist/dts/ConfigProvider.d.ts +84 -0
  147. package/dist/dts/ConfigProvider.d.ts.map +1 -1
  148. package/dist/dts/ConfigProviderPathPatch.d.ts +32 -0
  149. package/dist/dts/ConfigProviderPathPatch.d.ts.map +1 -1
  150. package/dist/dts/Console.d.ts +24 -0
  151. package/dist/dts/Console.d.ts.map +1 -1
  152. package/dist/dts/Context.d.ts +232 -0
  153. package/dist/dts/Context.d.ts.map +1 -1
  154. package/dist/dts/Cron.d.ts +12 -0
  155. package/dist/dts/Cron.d.ts.map +1 -1
  156. package/dist/dts/Data.d.ts +165 -0
  157. package/dist/dts/Data.d.ts.map +1 -1
  158. package/dist/dts/DateTime.d.ts +878 -0
  159. package/dist/dts/DateTime.d.ts.map +1 -1
  160. package/dist/dts/Deferred.d.ts +170 -0
  161. package/dist/dts/Deferred.d.ts.map +1 -1
  162. package/dist/dts/Differ.d.ts +78 -0
  163. package/dist/dts/Differ.d.ts.map +1 -1
  164. package/dist/dts/Duration.d.ts +130 -0
  165. package/dist/dts/Duration.d.ts.map +1 -1
  166. package/dist/dts/Effect.d.ts +4117 -3
  167. package/dist/dts/Effect.d.ts.map +1 -1
  168. package/dist/dts/Either.d.ts +620 -0
  169. package/dist/dts/Either.d.ts.map +1 -1
  170. package/dist/dts/Equivalence.d.ts +24 -0
  171. package/dist/dts/Equivalence.d.ts.map +1 -1
  172. package/dist/dts/ExecutionStrategy.d.ts +14 -0
  173. package/dist/dts/ExecutionStrategy.d.ts.map +1 -1
  174. package/dist/dts/Exit.d.ts +252 -0
  175. package/dist/dts/Exit.d.ts.map +1 -1
  176. package/dist/dts/Fiber.d.ts +182 -0
  177. package/dist/dts/Fiber.d.ts.map +1 -1
  178. package/dist/dts/FiberHandle.d.ts +42 -0
  179. package/dist/dts/FiberHandle.d.ts.map +1 -1
  180. package/dist/dts/FiberId.d.ts +24 -0
  181. package/dist/dts/FiberId.d.ts.map +1 -1
  182. package/dist/dts/FiberMap.d.ts +102 -0
  183. package/dist/dts/FiberMap.d.ts.map +1 -1
  184. package/dist/dts/FiberRef.d.ts +80 -0
  185. package/dist/dts/FiberRef.d.ts.map +1 -1
  186. package/dist/dts/FiberRefs.d.ts +84 -0
  187. package/dist/dts/FiberRefs.d.ts.map +1 -1
  188. package/dist/dts/FiberRefsPatch.d.ts +30 -0
  189. package/dist/dts/FiberRefsPatch.d.ts.map +1 -1
  190. package/dist/dts/FiberSet.d.ts +38 -0
  191. package/dist/dts/FiberSet.d.ts.map +1 -1
  192. package/dist/dts/Function.d.ts +144 -28
  193. package/dist/dts/Function.d.ts.map +1 -1
  194. package/dist/dts/GroupBy.d.ts +38 -0
  195. package/dist/dts/GroupBy.d.ts.map +1 -1
  196. package/dist/dts/Hash.d.ts +8 -0
  197. package/dist/dts/Hash.d.ts.map +1 -1
  198. package/dist/dts/HashMap.d.ts +300 -0
  199. package/dist/dts/HashMap.d.ts.map +1 -1
  200. package/dist/dts/HashSet.d.ts +284 -0
  201. package/dist/dts/HashSet.d.ts.map +1 -1
  202. package/dist/dts/Iterable.d.ts +454 -0
  203. package/dist/dts/Iterable.d.ts.map +1 -1
  204. package/dist/dts/KeyedPool.d.ts +34 -0
  205. package/dist/dts/KeyedPool.d.ts.map +1 -1
  206. package/dist/dts/Layer.d.ts +414 -0
  207. package/dist/dts/Layer.d.ts.map +1 -1
  208. package/dist/dts/List.d.ts +430 -0
  209. package/dist/dts/List.d.ts.map +1 -1
  210. package/dist/dts/LogLevel.d.ts +46 -0
  211. package/dist/dts/LogLevel.d.ts.map +1 -1
  212. package/dist/dts/Logger.d.ts +194 -0
  213. package/dist/dts/Logger.d.ts.map +1 -1
  214. package/dist/dts/Mailbox.d.ts +16 -0
  215. package/dist/dts/Mailbox.d.ts.map +1 -1
  216. package/dist/dts/MergeDecision.d.ts +8 -0
  217. package/dist/dts/MergeDecision.d.ts.map +1 -1
  218. package/dist/dts/MergeState.d.ts +8 -0
  219. package/dist/dts/MergeState.d.ts.map +1 -1
  220. package/dist/dts/MergeStrategy.d.ts +12 -0
  221. package/dist/dts/MergeStrategy.d.ts.map +1 -1
  222. package/dist/dts/Metric.d.ts +410 -0
  223. package/dist/dts/Metric.d.ts.map +1 -1
  224. package/dist/dts/MetricHook.d.ts +24 -0
  225. package/dist/dts/MetricHook.d.ts.map +1 -1
  226. package/dist/dts/MetricKey.d.ts +48 -0
  227. package/dist/dts/MetricKey.d.ts.map +1 -1
  228. package/dist/dts/MetricPolling.d.ts +40 -0
  229. package/dist/dts/MetricPolling.d.ts.map +1 -1
  230. package/dist/dts/MetricState.d.ts +16 -0
  231. package/dist/dts/MetricState.d.ts.map +1 -1
  232. package/dist/dts/Micro.d.ts +1110 -0
  233. package/dist/dts/Micro.d.ts.map +1 -1
  234. package/dist/dts/MutableHashMap.d.ts +50 -0
  235. package/dist/dts/MutableHashMap.d.ts.map +1 -1
  236. package/dist/dts/MutableHashSet.d.ts +24 -0
  237. package/dist/dts/MutableHashSet.d.ts.map +1 -1
  238. package/dist/dts/MutableList.d.ts +36 -0
  239. package/dist/dts/MutableList.d.ts.map +1 -1
  240. package/dist/dts/MutableQueue.d.ts +62 -0
  241. package/dist/dts/MutableQueue.d.ts.map +1 -1
  242. package/dist/dts/MutableRef.d.ts +56 -0
  243. package/dist/dts/MutableRef.d.ts.map +1 -1
  244. package/dist/dts/Number.d.ts +474 -0
  245. package/dist/dts/Number.d.ts.map +1 -1
  246. package/dist/dts/Option.d.ts +1019 -0
  247. package/dist/dts/Option.d.ts.map +1 -1
  248. package/dist/dts/Order.d.ts +24 -0
  249. package/dist/dts/Order.d.ts.map +1 -1
  250. package/dist/dts/Ordering.d.ts +66 -0
  251. package/dist/dts/Ordering.d.ts.map +1 -1
  252. package/dist/dts/Pipeable.d.ts +21 -21
  253. package/dist/dts/Pipeable.d.ts.map +1 -1
  254. package/dist/dts/Pool.d.ts +16 -0
  255. package/dist/dts/Pool.d.ts.map +1 -1
  256. package/dist/dts/Predicate.d.ts +498 -0
  257. package/dist/dts/Predicate.d.ts.map +1 -1
  258. package/dist/dts/PubSub.d.ts +28 -0
  259. package/dist/dts/PubSub.d.ts.map +1 -1
  260. package/dist/dts/Queue.d.ts +104 -0
  261. package/dist/dts/Queue.d.ts.map +1 -1
  262. package/dist/dts/RcMap.d.ts +70 -0
  263. package/dist/dts/RcMap.d.ts.map +1 -1
  264. package/dist/dts/Readable.d.ts +16 -0
  265. package/dist/dts/Readable.d.ts.map +1 -1
  266. package/dist/dts/Record.d.ts +800 -0
  267. package/dist/dts/Record.d.ts.map +1 -1
  268. package/dist/dts/RedBlackTree.d.ts +300 -0
  269. package/dist/dts/RedBlackTree.d.ts.map +1 -1
  270. package/dist/dts/Ref.d.ts +88 -0
  271. package/dist/dts/Ref.d.ts.map +1 -1
  272. package/dist/dts/Request.d.ts +76 -0
  273. package/dist/dts/Request.d.ts.map +1 -1
  274. package/dist/dts/RequestResolver.d.ts +144 -0
  275. package/dist/dts/RequestResolver.d.ts.map +1 -1
  276. package/dist/dts/Runtime.d.ts +126 -0
  277. package/dist/dts/Runtime.d.ts.map +1 -1
  278. package/dist/dts/RuntimeFlags.d.ts +100 -0
  279. package/dist/dts/RuntimeFlags.d.ts.map +1 -1
  280. package/dist/dts/RuntimeFlagsPatch.d.ts +112 -0
  281. package/dist/dts/RuntimeFlagsPatch.d.ts.map +1 -1
  282. package/dist/dts/STM.d.ts +1090 -0
  283. package/dist/dts/STM.d.ts.map +1 -1
  284. package/dist/dts/Schedule.d.ts +704 -0
  285. package/dist/dts/Schedule.d.ts.map +1 -1
  286. package/dist/dts/ScheduleInterval.d.ts +68 -0
  287. package/dist/dts/ScheduleInterval.d.ts.map +1 -1
  288. package/dist/dts/ScheduleIntervals.d.ts +50 -0
  289. package/dist/dts/ScheduleIntervals.d.ts.map +1 -1
  290. package/dist/dts/Scope.d.ts +36 -0
  291. package/dist/dts/Scope.d.ts.map +1 -1
  292. package/dist/dts/ScopedRef.d.ts +22 -0
  293. package/dist/dts/ScopedRef.d.ts.map +1 -1
  294. package/dist/dts/Sink.d.ts +464 -0
  295. package/dist/dts/Sink.d.ts.map +1 -1
  296. package/dist/dts/SortedMap.d.ts +76 -0
  297. package/dist/dts/SortedMap.d.ts.map +1 -1
  298. package/dist/dts/SortedSet.d.ts +142 -0
  299. package/dist/dts/SortedSet.d.ts.map +1 -1
  300. package/dist/dts/Stream.d.ts +4998 -1
  301. package/dist/dts/Stream.d.ts.map +1 -1
  302. package/dist/dts/StreamHaltStrategy.d.ts +12 -0
  303. package/dist/dts/StreamHaltStrategy.d.ts.map +1 -1
  304. package/dist/dts/String.d.ts +200 -0
  305. package/dist/dts/String.d.ts.map +1 -1
  306. package/dist/dts/Struct.d.ts +84 -0
  307. package/dist/dts/Struct.d.ts.map +1 -1
  308. package/dist/dts/Subscribable.d.ts +16 -0
  309. package/dist/dts/Subscribable.d.ts.map +1 -1
  310. package/dist/dts/SubscriptionRef.d.ts +152 -0
  311. package/dist/dts/SubscriptionRef.d.ts.map +1 -1
  312. package/dist/dts/SynchronizedRef.d.ts +152 -0
  313. package/dist/dts/SynchronizedRef.d.ts.map +1 -1
  314. package/dist/dts/TArray.d.ts +426 -0
  315. package/dist/dts/TArray.d.ts.map +1 -1
  316. package/dist/dts/TDeferred.d.ts +24 -0
  317. package/dist/dts/TDeferred.d.ts.map +1 -1
  318. package/dist/dts/TMap.d.ts +366 -0
  319. package/dist/dts/TMap.d.ts.map +1 -1
  320. package/dist/dts/TPriorityQueue.d.ts +60 -0
  321. package/dist/dts/TPriorityQueue.d.ts.map +1 -1
  322. package/dist/dts/TPubSub.d.ts +28 -0
  323. package/dist/dts/TPubSub.d.ts.map +1 -1
  324. package/dist/dts/TQueue.d.ts +108 -0
  325. package/dist/dts/TQueue.d.ts.map +1 -1
  326. package/dist/dts/TReentrantLock.d.ts +36 -0
  327. package/dist/dts/TReentrantLock.d.ts.map +1 -1
  328. package/dist/dts/TRef.d.ts +88 -0
  329. package/dist/dts/TRef.d.ts.map +1 -1
  330. package/dist/dts/TSemaphore.d.ts +40 -0
  331. package/dist/dts/TSemaphore.d.ts.map +1 -1
  332. package/dist/dts/TSet.d.ts +254 -0
  333. package/dist/dts/TSet.d.ts.map +1 -1
  334. package/dist/dts/Take.d.ts +56 -0
  335. package/dist/dts/Take.d.ts.map +1 -1
  336. package/dist/dts/TestAnnotationMap.d.ts.map +1 -1
  337. package/dist/dts/TestClock.d.ts.map +1 -1
  338. package/dist/dts/TestServices.d.ts.map +1 -1
  339. package/dist/dts/Trie.d.ts +906 -0
  340. package/dist/dts/Trie.d.ts.map +1 -1
  341. package/dist/dts/Tuple.d.ts +144 -0
  342. package/dist/dts/Tuple.d.ts.map +1 -1
  343. package/dist/dts/Unify.d.ts +18 -0
  344. package/dist/dts/Unify.d.ts.map +1 -1
  345. package/dist/dts/UpstreamPullRequest.d.ts +12 -0
  346. package/dist/dts/UpstreamPullRequest.d.ts.map +1 -1
  347. package/dist/dts/UpstreamPullStrategy.d.ts +12 -0
  348. package/dist/dts/UpstreamPullStrategy.d.ts.map +1 -1
  349. package/dist/dts/Utils.d.ts.map +1 -1
  350. package/dist/dts/internal/stream.d.ts.map +1 -1
  351. package/dist/esm/Array.js.map +1 -1
  352. package/dist/esm/BigDecimal.js +2 -2
  353. package/dist/esm/BigDecimal.js.map +1 -1
  354. package/dist/esm/BigInt.js.map +1 -1
  355. package/dist/esm/Boolean.js.map +1 -1
  356. package/dist/esm/Cause.js.map +1 -1
  357. package/dist/esm/Channel.js.map +1 -1
  358. package/dist/esm/ChildExecutorDecision.js.map +1 -1
  359. package/dist/esm/Chunk.js.map +1 -1
  360. package/dist/esm/Config.js.map +1 -1
  361. package/dist/esm/ConfigError.js.map +1 -1
  362. package/dist/esm/ConfigProvider.js.map +1 -1
  363. package/dist/esm/ConfigProviderPathPatch.js.map +1 -1
  364. package/dist/esm/Console.js.map +1 -1
  365. package/dist/esm/Context.js.map +1 -1
  366. package/dist/esm/Cron.js.map +1 -1
  367. package/dist/esm/Data.js.map +1 -1
  368. package/dist/esm/DateTime.js.map +1 -1
  369. package/dist/esm/Deferred.js.map +1 -1
  370. package/dist/esm/Differ.js.map +1 -1
  371. package/dist/esm/Duration.js.map +1 -1
  372. package/dist/esm/Effect.js.map +1 -1
  373. package/dist/esm/Either.js.map +1 -1
  374. package/dist/esm/Equivalence.js.map +1 -1
  375. package/dist/esm/ExecutionStrategy.js.map +1 -1
  376. package/dist/esm/Exit.js.map +1 -1
  377. package/dist/esm/Fiber.js.map +1 -1
  378. package/dist/esm/FiberHandle.js.map +1 -1
  379. package/dist/esm/FiberId.js.map +1 -1
  380. package/dist/esm/FiberMap.js.map +1 -1
  381. package/dist/esm/FiberRef.js.map +1 -1
  382. package/dist/esm/FiberRefs.js.map +1 -1
  383. package/dist/esm/FiberRefsPatch.js.map +1 -1
  384. package/dist/esm/FiberSet.js.map +1 -1
  385. package/dist/esm/Function.js.map +1 -1
  386. package/dist/esm/GroupBy.js.map +1 -1
  387. package/dist/esm/Hash.js.map +1 -1
  388. package/dist/esm/HashMap.js.map +1 -1
  389. package/dist/esm/HashSet.js.map +1 -1
  390. package/dist/esm/Iterable.js.map +1 -1
  391. package/dist/esm/KeyedPool.js.map +1 -1
  392. package/dist/esm/Layer.js.map +1 -1
  393. package/dist/esm/List.js.map +1 -1
  394. package/dist/esm/LogLevel.js.map +1 -1
  395. package/dist/esm/Logger.js.map +1 -1
  396. package/dist/esm/Mailbox.js.map +1 -1
  397. package/dist/esm/MergeDecision.js.map +1 -1
  398. package/dist/esm/MergeState.js.map +1 -1
  399. package/dist/esm/MergeStrategy.js.map +1 -1
  400. package/dist/esm/Metric.js.map +1 -1
  401. package/dist/esm/MetricHook.js.map +1 -1
  402. package/dist/esm/MetricKey.js.map +1 -1
  403. package/dist/esm/MetricPolling.js.map +1 -1
  404. package/dist/esm/MetricState.js.map +1 -1
  405. package/dist/esm/Micro.js.map +1 -1
  406. package/dist/esm/MutableHashMap.js.map +1 -1
  407. package/dist/esm/MutableHashSet.js.map +1 -1
  408. package/dist/esm/MutableList.js.map +1 -1
  409. package/dist/esm/MutableQueue.js.map +1 -1
  410. package/dist/esm/MutableRef.js.map +1 -1
  411. package/dist/esm/Number.js.map +1 -1
  412. package/dist/esm/Option.js.map +1 -1
  413. package/dist/esm/Order.js.map +1 -1
  414. package/dist/esm/Ordering.js.map +1 -1
  415. package/dist/esm/Pipeable.js.map +1 -1
  416. package/dist/esm/Pool.js.map +1 -1
  417. package/dist/esm/Predicate.js.map +1 -1
  418. package/dist/esm/PubSub.js.map +1 -1
  419. package/dist/esm/Queue.js.map +1 -1
  420. package/dist/esm/RcMap.js.map +1 -1
  421. package/dist/esm/Readable.js.map +1 -1
  422. package/dist/esm/Record.js.map +1 -1
  423. package/dist/esm/RedBlackTree.js.map +1 -1
  424. package/dist/esm/Ref.js.map +1 -1
  425. package/dist/esm/Request.js.map +1 -1
  426. package/dist/esm/RequestResolver.js.map +1 -1
  427. package/dist/esm/Runtime.js.map +1 -1
  428. package/dist/esm/RuntimeFlags.js.map +1 -1
  429. package/dist/esm/RuntimeFlagsPatch.js.map +1 -1
  430. package/dist/esm/STM.js.map +1 -1
  431. package/dist/esm/Schedule.js.map +1 -1
  432. package/dist/esm/ScheduleInterval.js.map +1 -1
  433. package/dist/esm/ScheduleIntervals.js.map +1 -1
  434. package/dist/esm/Scheduler.js.map +1 -1
  435. package/dist/esm/Scope.js.map +1 -1
  436. package/dist/esm/ScopedRef.js.map +1 -1
  437. package/dist/esm/Sink.js.map +1 -1
  438. package/dist/esm/SortedMap.js.map +1 -1
  439. package/dist/esm/SortedSet.js.map +1 -1
  440. package/dist/esm/Stream.js +14 -0
  441. package/dist/esm/Stream.js.map +1 -1
  442. package/dist/esm/StreamHaltStrategy.js.map +1 -1
  443. package/dist/esm/String.js.map +1 -1
  444. package/dist/esm/Struct.js.map +1 -1
  445. package/dist/esm/Subscribable.js.map +1 -1
  446. package/dist/esm/SubscriptionRef.js.map +1 -1
  447. package/dist/esm/SynchronizedRef.js.map +1 -1
  448. package/dist/esm/TArray.js.map +1 -1
  449. package/dist/esm/TDeferred.js.map +1 -1
  450. package/dist/esm/TMap.js.map +1 -1
  451. package/dist/esm/TPriorityQueue.js.map +1 -1
  452. package/dist/esm/TPubSub.js.map +1 -1
  453. package/dist/esm/TQueue.js.map +1 -1
  454. package/dist/esm/TReentrantLock.js.map +1 -1
  455. package/dist/esm/TRef.js.map +1 -1
  456. package/dist/esm/TSemaphore.js.map +1 -1
  457. package/dist/esm/TSet.js.map +1 -1
  458. package/dist/esm/Take.js.map +1 -1
  459. package/dist/esm/TestAnnotationMap.js.map +1 -1
  460. package/dist/esm/TestClock.js.map +1 -1
  461. package/dist/esm/TestServices.js.map +1 -1
  462. package/dist/esm/Trie.js.map +1 -1
  463. package/dist/esm/Tuple.js.map +1 -1
  464. package/dist/esm/Unify.js.map +1 -1
  465. package/dist/esm/UpstreamPullRequest.js.map +1 -1
  466. package/dist/esm/UpstreamPullStrategy.js.map +1 -1
  467. package/dist/esm/Utils.js +1 -14
  468. package/dist/esm/Utils.js.map +1 -1
  469. package/dist/esm/internal/core.js +1 -1
  470. package/dist/esm/internal/core.js.map +1 -1
  471. package/dist/esm/internal/runtime.js +1 -1
  472. package/dist/esm/internal/runtime.js.map +1 -1
  473. package/dist/esm/internal/stream.js +9 -0
  474. package/dist/esm/internal/stream.js.map +1 -1
  475. package/dist/esm/internal/version.js +1 -1
  476. package/package.json +1 -1
  477. package/src/Array.ts +2723 -36
  478. package/src/BigDecimal.ts +585 -18
  479. package/src/BigInt.ts +516 -16
  480. package/src/Boolean.ts +241 -8
  481. package/src/Cause.ts +177 -1
  482. package/src/Channel.ts +766 -49
  483. package/src/ChildExecutorDecision.ts +12 -0
  484. package/src/Chunk.ts +818 -4
  485. package/src/Config.ts +187 -8
  486. package/src/ConfigError.ts +16 -0
  487. package/src/ConfigProvider.ts +89 -1
  488. package/src/ConfigProviderPathPatch.ts +32 -0
  489. package/src/Console.ts +37 -8
  490. package/src/Context.ts +232 -0
  491. package/src/Cron.ts +12 -0
  492. package/src/Data.ts +165 -0
  493. package/src/DateTime.ts +1006 -50
  494. package/src/Deferred.ts +170 -0
  495. package/src/Differ.ts +89 -27
  496. package/src/Duration.ts +156 -16
  497. package/src/Effect.ts +4297 -123
  498. package/src/Either.ts +650 -34
  499. package/src/Equivalence.ts +24 -0
  500. package/src/ExecutionStrategy.ts +29 -10
  501. package/src/Exit.ts +252 -0
  502. package/src/Fiber.ts +182 -0
  503. package/src/FiberHandle.ts +42 -0
  504. package/src/FiberId.ts +24 -0
  505. package/src/FiberMap.ts +144 -21
  506. package/src/FiberRef.ts +80 -0
  507. package/src/FiberRefs.ts +84 -0
  508. package/src/FiberRefsPatch.ts +35 -1
  509. package/src/FiberSet.ts +38 -0
  510. package/src/Function.ts +416 -31
  511. package/src/GroupBy.ts +38 -0
  512. package/src/Hash.ts +8 -0
  513. package/src/HashMap.ts +300 -0
  514. package/src/HashSet.ts +284 -0
  515. package/src/Iterable.ts +456 -6
  516. package/src/KeyedPool.ts +34 -0
  517. package/src/Layer.ts +426 -30
  518. package/src/List.ts +476 -3
  519. package/src/LogLevel.ts +46 -0
  520. package/src/Logger.ts +195 -4
  521. package/src/Mailbox.ts +16 -0
  522. package/src/MergeDecision.ts +8 -0
  523. package/src/MergeState.ts +8 -0
  524. package/src/MergeStrategy.ts +25 -8
  525. package/src/Metric.ts +426 -15
  526. package/src/MetricHook.ts +24 -0
  527. package/src/MetricKey.ts +62 -8
  528. package/src/MetricPolling.ts +42 -6
  529. package/src/MetricState.ts +16 -0
  530. package/src/Micro.ts +1212 -56
  531. package/src/MutableHashMap.ts +105 -1
  532. package/src/MutableHashSet.ts +24 -0
  533. package/src/MutableList.ts +36 -0
  534. package/src/MutableQueue.ts +62 -0
  535. package/src/MutableRef.ts +56 -0
  536. package/src/Number.ts +500 -16
  537. package/src/Option.ts +1042 -16
  538. package/src/Order.ts +24 -0
  539. package/src/Ordering.ts +66 -0
  540. package/src/Pipeable.ts +224 -21
  541. package/src/Pool.ts +16 -0
  542. package/src/Predicate.ts +498 -0
  543. package/src/PubSub.ts +28 -0
  544. package/src/Queue.ts +104 -0
  545. package/src/RcMap.ts +70 -0
  546. package/src/Readable.ts +18 -7
  547. package/src/Record.ts +814 -40
  548. package/src/RedBlackTree.ts +305 -1
  549. package/src/Ref.ts +88 -0
  550. package/src/Request.ts +76 -0
  551. package/src/RequestResolver.ts +145 -4
  552. package/src/Runtime.ts +134 -2
  553. package/src/RuntimeFlags.ts +100 -0
  554. package/src/RuntimeFlagsPatch.ts +112 -0
  555. package/src/STM.ts +1107 -11
  556. package/src/Schedule.ts +704 -0
  557. package/src/ScheduleInterval.ts +68 -0
  558. package/src/ScheduleIntervals.ts +50 -0
  559. package/src/Scheduler.ts +2 -0
  560. package/src/Scope.ts +36 -0
  561. package/src/ScopedRef.ts +22 -0
  562. package/src/Sink.ts +464 -0
  563. package/src/SortedMap.ts +76 -0
  564. package/src/SortedSet.ts +143 -3
  565. package/src/Stream.ts +5041 -54
  566. package/src/StreamHaltStrategy.ts +29 -12
  567. package/src/String.ts +200 -0
  568. package/src/Struct.ts +86 -7
  569. package/src/Subscribable.ts +16 -0
  570. package/src/SubscriptionRef.ts +159 -11
  571. package/src/SynchronizedRef.ts +169 -8
  572. package/src/TArray.ts +431 -1
  573. package/src/TDeferred.ts +24 -0
  574. package/src/TMap.ts +381 -12
  575. package/src/TPriorityQueue.ts +60 -0
  576. package/src/TPubSub.ts +28 -0
  577. package/src/TQueue.ts +108 -0
  578. package/src/TReentrantLock.ts +36 -0
  579. package/src/TRef.ts +88 -0
  580. package/src/TSemaphore.ts +40 -0
  581. package/src/TSet.ts +280 -12
  582. package/src/Take.ts +56 -0
  583. package/src/TestAnnotationMap.ts +45 -1
  584. package/src/TestClock.ts +6 -0
  585. package/src/TestServices.ts +66 -0
  586. package/src/Trie.ts +906 -0
  587. package/src/Tuple.ts +157 -8
  588. package/src/Unify.ts +19 -3
  589. package/src/UpstreamPullRequest.ts +12 -0
  590. package/src/UpstreamPullStrategy.ts +12 -0
  591. package/src/Utils.ts +1 -15
  592. package/src/internal/core.ts +1 -1
  593. package/src/internal/runtime.ts +1 -1
  594. package/src/internal/stream.ts +27 -0
  595. package/src/internal/version.ts +1 -1
@@ -95,7 +95,33 @@ export declare const range: (start: number, end: number) => NonEmptyArray<number
95
95
  * @since 2.0.0
96
96
  */
97
97
  export declare const replicate: {
98
+ /**
99
+ * Return a `NonEmptyArray` containing a value repeated the specified number of times.
100
+ *
101
+ * **Note**. `n` is normalized to an integer >= 1.
102
+ *
103
+ * @example
104
+ * import { Array } from "effect"
105
+ *
106
+ * assert.deepStrictEqual(Array.replicate("a", 3), ["a", "a", "a"])
107
+ *
108
+ * @category constructors
109
+ * @since 2.0.0
110
+ */
98
111
  (n: number): <A>(a: A) => NonEmptyArray<A>;
112
+ /**
113
+ * Return a `NonEmptyArray` containing a value repeated the specified number of times.
114
+ *
115
+ * **Note**. `n` is normalized to an integer >= 1.
116
+ *
117
+ * @example
118
+ * import { Array } from "effect"
119
+ *
120
+ * assert.deepStrictEqual(Array.replicate("a", 3), ["a", "a", "a"])
121
+ *
122
+ * @category constructors
123
+ * @since 2.0.0
124
+ */
99
125
  <A>(a: A, n: number): NonEmptyArray<A>;
100
126
  };
101
127
  /**
@@ -173,10 +199,42 @@ export declare const fromOption: <A>(self: Option<A>) => Array<A>;
173
199
  * @since 2.0.0
174
200
  */
175
201
  export declare const match: {
202
+ /**
203
+ * Matches the elements of an array, applying functions to cases of empty and non-empty arrays.
204
+ *
205
+ * @example
206
+ * import { Array } from "effect"
207
+ *
208
+ * const match = Array.match({
209
+ * onEmpty: () => "empty",
210
+ * onNonEmpty: ([head, ...tail]) => `head: ${head}, tail: ${tail.length}`
211
+ * })
212
+ * assert.deepStrictEqual(match([]), "empty")
213
+ * assert.deepStrictEqual(match([1, 2, 3]), "head: 1, tail: 2")
214
+ *
215
+ * @category pattern matching
216
+ * @since 2.0.0
217
+ */
176
218
  <B, A, C = B>(options: {
177
219
  readonly onEmpty: LazyArg<B>;
178
220
  readonly onNonEmpty: (self: NonEmptyReadonlyArray<A>) => C;
179
221
  }): (self: ReadonlyArray<A>) => B | C;
222
+ /**
223
+ * Matches the elements of an array, applying functions to cases of empty and non-empty arrays.
224
+ *
225
+ * @example
226
+ * import { Array } from "effect"
227
+ *
228
+ * const match = Array.match({
229
+ * onEmpty: () => "empty",
230
+ * onNonEmpty: ([head, ...tail]) => `head: ${head}, tail: ${tail.length}`
231
+ * })
232
+ * assert.deepStrictEqual(match([]), "empty")
233
+ * assert.deepStrictEqual(match([1, 2, 3]), "head: 1, tail: 2")
234
+ *
235
+ * @category pattern matching
236
+ * @since 2.0.0
237
+ */
180
238
  <A, B, C = B>(self: ReadonlyArray<A>, options: {
181
239
  readonly onEmpty: LazyArg<B>;
182
240
  readonly onNonEmpty: (self: NonEmptyReadonlyArray<A>) => C;
@@ -199,10 +257,42 @@ export declare const match: {
199
257
  * @since 2.0.0
200
258
  */
201
259
  export declare const matchLeft: {
260
+ /**
261
+ * Matches the elements of an array from the left, applying functions to cases of empty and non-empty arrays.
262
+ *
263
+ * @example
264
+ * import { Array } from "effect"
265
+ *
266
+ * const matchLeft = Array.matchLeft({
267
+ * onEmpty: () => "empty",
268
+ * onNonEmpty: (head, tail) => `head: ${head}, tail: ${tail.length}`
269
+ * })
270
+ * assert.deepStrictEqual(matchLeft([]), "empty")
271
+ * assert.deepStrictEqual(matchLeft([1, 2, 3]), "head: 1, tail: 2")
272
+ *
273
+ * @category pattern matching
274
+ * @since 2.0.0
275
+ */
202
276
  <B, A, C = B>(options: {
203
277
  readonly onEmpty: LazyArg<B>;
204
278
  readonly onNonEmpty: (head: A, tail: Array<A>) => C;
205
279
  }): (self: ReadonlyArray<A>) => B | C;
280
+ /**
281
+ * Matches the elements of an array from the left, applying functions to cases of empty and non-empty arrays.
282
+ *
283
+ * @example
284
+ * import { Array } from "effect"
285
+ *
286
+ * const matchLeft = Array.matchLeft({
287
+ * onEmpty: () => "empty",
288
+ * onNonEmpty: (head, tail) => `head: ${head}, tail: ${tail.length}`
289
+ * })
290
+ * assert.deepStrictEqual(matchLeft([]), "empty")
291
+ * assert.deepStrictEqual(matchLeft([1, 2, 3]), "head: 1, tail: 2")
292
+ *
293
+ * @category pattern matching
294
+ * @since 2.0.0
295
+ */
206
296
  <A, B, C = B>(self: ReadonlyArray<A>, options: {
207
297
  readonly onEmpty: LazyArg<B>;
208
298
  readonly onNonEmpty: (head: A, tail: Array<A>) => C;
@@ -225,10 +315,42 @@ export declare const matchLeft: {
225
315
  * @since 2.0.0
226
316
  */
227
317
  export declare const matchRight: {
318
+ /**
319
+ * Matches the elements of an array from the right, applying functions to cases of empty and non-empty arrays.
320
+ *
321
+ * @example
322
+ * import { Array } from "effect"
323
+ *
324
+ * const matchRight = Array.matchRight({
325
+ * onEmpty: () => "empty",
326
+ * onNonEmpty: (init, last) => `init: ${init.length}, last: ${last}`
327
+ * })
328
+ * assert.deepStrictEqual(matchRight([]), "empty")
329
+ * assert.deepStrictEqual(matchRight([1, 2, 3]), "init: 2, last: 3")
330
+ *
331
+ * @category pattern matching
332
+ * @since 2.0.0
333
+ */
228
334
  <B, A, C = B>(options: {
229
335
  readonly onEmpty: LazyArg<B>;
230
336
  readonly onNonEmpty: (init: Array<A>, last: A) => C;
231
337
  }): (self: ReadonlyArray<A>) => B | C;
338
+ /**
339
+ * Matches the elements of an array from the right, applying functions to cases of empty and non-empty arrays.
340
+ *
341
+ * @example
342
+ * import { Array } from "effect"
343
+ *
344
+ * const matchRight = Array.matchRight({
345
+ * onEmpty: () => "empty",
346
+ * onNonEmpty: (init, last) => `init: ${init.length}, last: ${last}`
347
+ * })
348
+ * assert.deepStrictEqual(matchRight([]), "empty")
349
+ * assert.deepStrictEqual(matchRight([1, 2, 3]), "init: 2, last: 3")
350
+ *
351
+ * @category pattern matching
352
+ * @since 2.0.0
353
+ */
232
354
  <A, B, C = B>(self: ReadonlyArray<A>, options: {
233
355
  readonly onEmpty: LazyArg<B>;
234
356
  readonly onNonEmpty: (init: Array<A>, last: A) => C;
@@ -248,7 +370,33 @@ export declare const matchRight: {
248
370
  * @since 2.0.0
249
371
  */
250
372
  export declare const prepend: {
373
+ /**
374
+ * Prepend an element to the front of an `Iterable`, creating a new `NonEmptyArray`.
375
+ *
376
+ * @example
377
+ * import { Array } from "effect"
378
+ *
379
+ * const original = [2, 3, 4];
380
+ * const result = Array.prepend(original, 1);
381
+ * assert.deepStrictEqual(result, [1, 2, 3, 4]);
382
+ *
383
+ * @category concatenating
384
+ * @since 2.0.0
385
+ */
251
386
  <B>(head: B): <A>(self: Iterable<A>) => NonEmptyArray<A | B>;
387
+ /**
388
+ * Prepend an element to the front of an `Iterable`, creating a new `NonEmptyArray`.
389
+ *
390
+ * @example
391
+ * import { Array } from "effect"
392
+ *
393
+ * const original = [2, 3, 4];
394
+ * const result = Array.prepend(original, 1);
395
+ * assert.deepStrictEqual(result, [1, 2, 3, 4]);
396
+ *
397
+ * @category concatenating
398
+ * @since 2.0.0
399
+ */
252
400
  <A, B>(self: Iterable<A>, head: B): NonEmptyArray<A | B>;
253
401
  };
254
402
  /**
@@ -267,9 +415,69 @@ export declare const prepend: {
267
415
  * @since 2.0.0
268
416
  */
269
417
  export declare const prependAll: {
418
+ /**
419
+ * Prepends the specified prefix array (or iterable) to the beginning of the specified array (or iterable).
420
+ * If either array is non-empty, the result is also a non-empty array.
421
+ *
422
+ * @example
423
+ * import { Array } from "effect"
424
+ *
425
+ * const prefix = [0, 1];
426
+ * const array = [2, 3];
427
+ * const result = Array.prependAll(array, prefix);
428
+ * assert.deepStrictEqual(result, [0, 1, 2, 3]);
429
+ *
430
+ * @category concatenating
431
+ * @since 2.0.0
432
+ */
270
433
  <S extends Iterable<any>, T extends Iterable<any>>(that: T): (self: S) => ReadonlyArray.OrNonEmpty<S, T, ReadonlyArray.Infer<S> | ReadonlyArray.Infer<T>>;
434
+ /**
435
+ * Prepends the specified prefix array (or iterable) to the beginning of the specified array (or iterable).
436
+ * If either array is non-empty, the result is also a non-empty array.
437
+ *
438
+ * @example
439
+ * import { Array } from "effect"
440
+ *
441
+ * const prefix = [0, 1];
442
+ * const array = [2, 3];
443
+ * const result = Array.prependAll(array, prefix);
444
+ * assert.deepStrictEqual(result, [0, 1, 2, 3]);
445
+ *
446
+ * @category concatenating
447
+ * @since 2.0.0
448
+ */
271
449
  <A, B>(self: Iterable<A>, that: NonEmptyReadonlyArray<B>): NonEmptyArray<A | B>;
450
+ /**
451
+ * Prepends the specified prefix array (or iterable) to the beginning of the specified array (or iterable).
452
+ * If either array is non-empty, the result is also a non-empty array.
453
+ *
454
+ * @example
455
+ * import { Array } from "effect"
456
+ *
457
+ * const prefix = [0, 1];
458
+ * const array = [2, 3];
459
+ * const result = Array.prependAll(array, prefix);
460
+ * assert.deepStrictEqual(result, [0, 1, 2, 3]);
461
+ *
462
+ * @category concatenating
463
+ * @since 2.0.0
464
+ */
272
465
  <A, B>(self: NonEmptyReadonlyArray<A>, that: Iterable<B>): NonEmptyArray<A | B>;
466
+ /**
467
+ * Prepends the specified prefix array (or iterable) to the beginning of the specified array (or iterable).
468
+ * If either array is non-empty, the result is also a non-empty array.
469
+ *
470
+ * @example
471
+ * import { Array } from "effect"
472
+ *
473
+ * const prefix = [0, 1];
474
+ * const array = [2, 3];
475
+ * const result = Array.prependAll(array, prefix);
476
+ * assert.deepStrictEqual(result, [0, 1, 2, 3]);
477
+ *
478
+ * @category concatenating
479
+ * @since 2.0.0
480
+ */
273
481
  <A, B>(self: Iterable<A>, that: Iterable<B>): Array<A | B>;
274
482
  };
275
483
  /**
@@ -286,7 +494,33 @@ export declare const prependAll: {
286
494
  * @since 2.0.0
287
495
  */
288
496
  export declare const append: {
497
+ /**
498
+ * Append an element to the end of an `Iterable`, creating a new `NonEmptyArray`.
499
+ *
500
+ * @example
501
+ * import { Array } from "effect"
502
+ *
503
+ * const original = [1, 2, 3];
504
+ * const result = Array.append(original, 4);
505
+ * assert.deepStrictEqual(result, [1, 2, 3, 4]);
506
+ *
507
+ * @category concatenating
508
+ * @since 2.0.0
509
+ */
289
510
  <B>(last: B): <A>(self: Iterable<A>) => NonEmptyArray<A | B>;
511
+ /**
512
+ * Append an element to the end of an `Iterable`, creating a new `NonEmptyArray`.
513
+ *
514
+ * @example
515
+ * import { Array } from "effect"
516
+ *
517
+ * const original = [1, 2, 3];
518
+ * const result = Array.append(original, 4);
519
+ * assert.deepStrictEqual(result, [1, 2, 3, 4]);
520
+ *
521
+ * @category concatenating
522
+ * @since 2.0.0
523
+ */
290
524
  <A, B>(self: Iterable<A>, last: B): NonEmptyArray<A | B>;
291
525
  };
292
526
  /**
@@ -297,9 +531,37 @@ export declare const append: {
297
531
  * @since 2.0.0
298
532
  */
299
533
  export declare const appendAll: {
534
+ /**
535
+ * Concatenates two arrays (or iterables), combining their elements.
536
+ * If either array is non-empty, the result is also a non-empty array.
537
+ *
538
+ * @category concatenating
539
+ * @since 2.0.0
540
+ */
300
541
  <S extends Iterable<any>, T extends Iterable<any>>(that: T): (self: S) => ReadonlyArray.OrNonEmpty<S, T, ReadonlyArray.Infer<S> | ReadonlyArray.Infer<T>>;
542
+ /**
543
+ * Concatenates two arrays (or iterables), combining their elements.
544
+ * If either array is non-empty, the result is also a non-empty array.
545
+ *
546
+ * @category concatenating
547
+ * @since 2.0.0
548
+ */
301
549
  <A, B>(self: Iterable<A>, that: NonEmptyReadonlyArray<B>): NonEmptyArray<A | B>;
550
+ /**
551
+ * Concatenates two arrays (or iterables), combining their elements.
552
+ * If either array is non-empty, the result is also a non-empty array.
553
+ *
554
+ * @category concatenating
555
+ * @since 2.0.0
556
+ */
302
557
  <A, B>(self: NonEmptyReadonlyArray<A>, that: Iterable<B>): NonEmptyArray<A | B>;
558
+ /**
559
+ * Concatenates two arrays (or iterables), combining their elements.
560
+ * If either array is non-empty, the result is also a non-empty array.
561
+ *
562
+ * @category concatenating
563
+ * @since 2.0.0
564
+ */
303
565
  <A, B>(self: Iterable<A>, that: Iterable<B>): Array<A | B>;
304
566
  };
305
567
  /**
@@ -324,7 +586,49 @@ export declare const appendAll: {
324
586
  * @since 2.0.0
325
587
  */
326
588
  export declare const scan: {
589
+ /**
590
+ * Accumulates values from an `Iterable` starting from the left, storing
591
+ * each intermediate result in an array. Useful for tracking the progression of
592
+ * a value through a series of transformations.
593
+ *
594
+ * @example
595
+ * import { Array } from "effect";
596
+ *
597
+ * const numbers = [1, 2, 3, 4]
598
+ * const result = Array.scan(numbers, 0, (acc, value) => acc + value)
599
+ * assert.deepStrictEqual(result, [0, 1, 3, 6, 10])
600
+ *
601
+ * // Explanation:
602
+ * // This function starts with the initial value (0 in this case)
603
+ * // and adds each element of the array to this accumulator one by one,
604
+ * // keeping track of the cumulative sum after each addition.
605
+ * // Each of these sums is captured in the resulting array.
606
+ *
607
+ * @category folding
608
+ * @since 2.0.0
609
+ */
327
610
  <B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<A>) => NonEmptyArray<B>;
611
+ /**
612
+ * Accumulates values from an `Iterable` starting from the left, storing
613
+ * each intermediate result in an array. Useful for tracking the progression of
614
+ * a value through a series of transformations.
615
+ *
616
+ * @example
617
+ * import { Array } from "effect";
618
+ *
619
+ * const numbers = [1, 2, 3, 4]
620
+ * const result = Array.scan(numbers, 0, (acc, value) => acc + value)
621
+ * assert.deepStrictEqual(result, [0, 1, 3, 6, 10])
622
+ *
623
+ * // Explanation:
624
+ * // This function starts with the initial value (0 in this case)
625
+ * // and adds each element of the array to this accumulator one by one,
626
+ * // keeping track of the cumulative sum after each addition.
627
+ * // Each of these sums is captured in the resulting array.
628
+ *
629
+ * @category folding
630
+ * @since 2.0.0
631
+ */
328
632
  <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>;
329
633
  };
330
634
  /**
@@ -343,7 +647,37 @@ export declare const scan: {
343
647
  * @since 2.0.0
344
648
  */
345
649
  export declare const scanRight: {
650
+ /**
651
+ * Accumulates values from an `Iterable` starting from the right, storing
652
+ * each intermediate result in an array. Useful for tracking the progression of
653
+ * a value through a series of transformations.
654
+ *
655
+ * @example
656
+ * import { Array } from "effect";
657
+ *
658
+ * const numbers = [1, 2, 3, 4]
659
+ * const result = Array.scanRight(numbers, 0, (acc, value) => acc + value)
660
+ * assert.deepStrictEqual(result, [10, 9, 7, 4, 0])
661
+ *
662
+ * @category folding
663
+ * @since 2.0.0
664
+ */
346
665
  <B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<A>) => NonEmptyArray<B>;
666
+ /**
667
+ * Accumulates values from an `Iterable` starting from the right, storing
668
+ * each intermediate result in an array. Useful for tracking the progression of
669
+ * a value through a series of transformations.
670
+ *
671
+ * @example
672
+ * import { Array } from "effect";
673
+ *
674
+ * const numbers = [1, 2, 3, 4]
675
+ * const result = Array.scanRight(numbers, 0, (acc, value) => acc + value)
676
+ * assert.deepStrictEqual(result, [10, 9, 7, 4, 0])
677
+ *
678
+ * @category folding
679
+ * @since 2.0.0
680
+ */
347
681
  <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): NonEmptyArray<B>;
348
682
  };
349
683
  /**
@@ -361,7 +695,35 @@ export declare const scanRight: {
361
695
  * @since 2.0.0
362
696
  */
363
697
  export declare const isArray: {
698
+ /**
699
+ * Determine if `unknown` is an Array.
700
+ *
701
+ * @param self - The value to check.
702
+ *
703
+ * @example
704
+ * import { isArray } from "effect/Array"
705
+ *
706
+ * assert.deepStrictEqual(isArray(null), false);
707
+ * assert.deepStrictEqual(isArray([1, 2, 3]), true);
708
+ *
709
+ * @category guards
710
+ * @since 2.0.0
711
+ */
364
712
  (self: unknown): self is Array<unknown>;
713
+ /**
714
+ * Determine if `unknown` is an Array.
715
+ *
716
+ * @param self - The value to check.
717
+ *
718
+ * @example
719
+ * import { isArray } from "effect/Array"
720
+ *
721
+ * assert.deepStrictEqual(isArray(null), false);
722
+ * assert.deepStrictEqual(isArray([1, 2, 3]), true);
723
+ *
724
+ * @category guards
725
+ * @since 2.0.0
726
+ */
365
727
  <T>(self: T): self is Extract<T, ReadonlyArray<any>>;
366
728
  };
367
729
  /**
@@ -442,7 +804,19 @@ export declare const length: <A>(self: ReadonlyArray<A>) => number;
442
804
  * @since 2.0.0
443
805
  */
444
806
  export declare const get: {
807
+ /**
808
+ * This function provides a safe way to read a value at a particular index from a `ReadonlyArray`.
809
+ *
810
+ * @category getters
811
+ * @since 2.0.0
812
+ */
445
813
  (index: number): <A>(self: ReadonlyArray<A>) => Option<A>;
814
+ /**
815
+ * This function provides a safe way to read a value at a particular index from a `ReadonlyArray`.
816
+ *
817
+ * @category getters
818
+ * @since 2.0.0
819
+ */
446
820
  <A>(self: ReadonlyArray<A>, index: number): Option<A>;
447
821
  };
448
822
  /**
@@ -452,7 +826,19 @@ export declare const get: {
452
826
  * @category unsafe
453
827
  */
454
828
  export declare const unsafeGet: {
829
+ /**
830
+ * Gets an element unsafely, will throw on out of bounds.
831
+ *
832
+ * @since 2.0.0
833
+ * @category unsafe
834
+ */
455
835
  (index: number): <A>(self: ReadonlyArray<A>) => A;
836
+ /**
837
+ * Gets an element unsafely, will throw on out of bounds.
838
+ *
839
+ * @since 2.0.0
840
+ * @category unsafe
841
+ */
456
842
  <A>(self: ReadonlyArray<A>, index: number): A;
457
843
  };
458
844
  /**
@@ -577,7 +963,37 @@ export declare const initNonEmpty: <A>(self: NonEmptyReadonlyArray<A>) => Array<
577
963
  * @since 2.0.0
578
964
  */
579
965
  export declare const take: {
966
+ /**
967
+ * Keep only a max number of elements from the start of an `Iterable`, creating a new `Array`.
968
+ *
969
+ * **Note**. `n` is normalized to a non negative integer.
970
+ *
971
+ * @example
972
+ * import { Array } from "effect"
973
+ *
974
+ * const numbers = [1, 2, 3, 4, 5]
975
+ * const result = Array.take(numbers, 3)
976
+ * assert.deepStrictEqual(result, [1, 2, 3])
977
+ *
978
+ * @category getters
979
+ * @since 2.0.0
980
+ */
580
981
  (n: number): <A>(self: Iterable<A>) => Array<A>;
982
+ /**
983
+ * Keep only a max number of elements from the start of an `Iterable`, creating a new `Array`.
984
+ *
985
+ * **Note**. `n` is normalized to a non negative integer.
986
+ *
987
+ * @example
988
+ * import { Array } from "effect"
989
+ *
990
+ * const numbers = [1, 2, 3, 4, 5]
991
+ * const result = Array.take(numbers, 3)
992
+ * assert.deepStrictEqual(result, [1, 2, 3])
993
+ *
994
+ * @category getters
995
+ * @since 2.0.0
996
+ */
581
997
  <A>(self: Iterable<A>, n: number): Array<A>;
582
998
  };
583
999
  /**
@@ -596,7 +1012,37 @@ export declare const take: {
596
1012
  * @since 2.0.0
597
1013
  */
598
1014
  export declare const takeRight: {
1015
+ /**
1016
+ * Keep only a max number of elements from the end of an `Iterable`, creating a new `Array`.
1017
+ *
1018
+ * **Note**. `n` is normalized to a non negative integer.
1019
+ *
1020
+ * @example
1021
+ * import { Array } from "effect"
1022
+ *
1023
+ * const numbers = [1, 2, 3, 4, 5]
1024
+ * const result = Array.takeRight(numbers, 3)
1025
+ * assert.deepStrictEqual(result, [3, 4, 5])
1026
+ *
1027
+ * @category getters
1028
+ * @since 2.0.0
1029
+ */
599
1030
  (n: number): <A>(self: Iterable<A>) => Array<A>;
1031
+ /**
1032
+ * Keep only a max number of elements from the end of an `Iterable`, creating a new `Array`.
1033
+ *
1034
+ * **Note**. `n` is normalized to a non negative integer.
1035
+ *
1036
+ * @example
1037
+ * import { Array } from "effect"
1038
+ *
1039
+ * const numbers = [1, 2, 3, 4, 5]
1040
+ * const result = Array.takeRight(numbers, 3)
1041
+ * assert.deepStrictEqual(result, [3, 4, 5])
1042
+ *
1043
+ * @category getters
1044
+ * @since 2.0.0
1045
+ */
600
1046
  <A>(self: Iterable<A>, n: number): Array<A>;
601
1047
  };
602
1048
  /**
@@ -619,9 +1065,85 @@ export declare const takeRight: {
619
1065
  * @since 2.0.0
620
1066
  */
621
1067
  export declare const takeWhile: {
1068
+ /**
1069
+ * Calculate the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
1070
+ *
1071
+ * @example
1072
+ * import { Array } from "effect"
1073
+ *
1074
+ * const numbers = [1, 3, 2, 4, 1, 2]
1075
+ * const result = Array.takeWhile(numbers, x => x < 4)
1076
+ * assert.deepStrictEqual(result, [1, 3, 2])
1077
+ *
1078
+ * // Explanation:
1079
+ * // - The function starts with the first element (`1`), which is less than `4`, so it adds `1` to the result.
1080
+ * // - The next element (`3`) is also less than `4`, so it adds `3`.
1081
+ * // - The next element (`2`) is again less than `4`, so it adds `2`.
1082
+ * // - The function then encounters `4`, which is not less than `4`. At this point, it stops checking further elements and finalizes the result.
1083
+ *
1084
+ * @category getters
1085
+ * @since 2.0.0
1086
+ */
622
1087
  <A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Array<B>;
1088
+ /**
1089
+ * Calculate the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
1090
+ *
1091
+ * @example
1092
+ * import { Array } from "effect"
1093
+ *
1094
+ * const numbers = [1, 3, 2, 4, 1, 2]
1095
+ * const result = Array.takeWhile(numbers, x => x < 4)
1096
+ * assert.deepStrictEqual(result, [1, 3, 2])
1097
+ *
1098
+ * // Explanation:
1099
+ * // - The function starts with the first element (`1`), which is less than `4`, so it adds `1` to the result.
1100
+ * // - The next element (`3`) is also less than `4`, so it adds `3`.
1101
+ * // - The next element (`2`) is again less than `4`, so it adds `2`.
1102
+ * // - The function then encounters `4`, which is not less than `4`. At this point, it stops checking further elements and finalizes the result.
1103
+ *
1104
+ * @category getters
1105
+ * @since 2.0.0
1106
+ */
623
1107
  <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Array<A>;
1108
+ /**
1109
+ * Calculate the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
1110
+ *
1111
+ * @example
1112
+ * import { Array } from "effect"
1113
+ *
1114
+ * const numbers = [1, 3, 2, 4, 1, 2]
1115
+ * const result = Array.takeWhile(numbers, x => x < 4)
1116
+ * assert.deepStrictEqual(result, [1, 3, 2])
1117
+ *
1118
+ * // Explanation:
1119
+ * // - The function starts with the first element (`1`), which is less than `4`, so it adds `1` to the result.
1120
+ * // - The next element (`3`) is also less than `4`, so it adds `3`.
1121
+ * // - The next element (`2`) is again less than `4`, so it adds `2`.
1122
+ * // - The function then encounters `4`, which is not less than `4`. At this point, it stops checking further elements and finalizes the result.
1123
+ *
1124
+ * @category getters
1125
+ * @since 2.0.0
1126
+ */
624
1127
  <A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Array<B>;
1128
+ /**
1129
+ * Calculate the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
1130
+ *
1131
+ * @example
1132
+ * import { Array } from "effect"
1133
+ *
1134
+ * const numbers = [1, 3, 2, 4, 1, 2]
1135
+ * const result = Array.takeWhile(numbers, x => x < 4)
1136
+ * assert.deepStrictEqual(result, [1, 3, 2])
1137
+ *
1138
+ * // Explanation:
1139
+ * // - The function starts with the first element (`1`), which is less than `4`, so it adds `1` to the result.
1140
+ * // - The next element (`3`) is also less than `4`, so it adds `3`.
1141
+ * // - The next element (`2`) is again less than `4`, so it adds `2`.
1142
+ * // - The function then encounters `4`, which is not less than `4`. At this point, it stops checking further elements and finalizes the result.
1143
+ *
1144
+ * @category getters
1145
+ * @since 2.0.0
1146
+ */
625
1147
  <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Array<A>;
626
1148
  };
627
1149
  /**
@@ -634,9 +1156,45 @@ export declare const takeWhile: {
634
1156
  * @since 2.0.0
635
1157
  */
636
1158
  export declare const span: {
1159
+ /**
1160
+ * Split an `Iterable` into two parts:
1161
+ *
1162
+ * 1. the longest initial subarray for which all elements satisfy the specified predicate
1163
+ * 2. the remaining elements
1164
+ *
1165
+ * @category splitting
1166
+ * @since 2.0.0
1167
+ */
637
1168
  <A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => [init: Array<B>, rest: Array<Exclude<A, B>>];
1169
+ /**
1170
+ * Split an `Iterable` into two parts:
1171
+ *
1172
+ * 1. the longest initial subarray for which all elements satisfy the specified predicate
1173
+ * 2. the remaining elements
1174
+ *
1175
+ * @category splitting
1176
+ * @since 2.0.0
1177
+ */
638
1178
  <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => [init: Array<A>, rest: Array<A>];
1179
+ /**
1180
+ * Split an `Iterable` into two parts:
1181
+ *
1182
+ * 1. the longest initial subarray for which all elements satisfy the specified predicate
1183
+ * 2. the remaining elements
1184
+ *
1185
+ * @category splitting
1186
+ * @since 2.0.0
1187
+ */
639
1188
  <A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): [init: Array<B>, rest: Array<Exclude<A, B>>];
1189
+ /**
1190
+ * Split an `Iterable` into two parts:
1191
+ *
1192
+ * 1. the longest initial subarray for which all elements satisfy the specified predicate
1193
+ * 2. the remaining elements
1194
+ *
1195
+ * @category splitting
1196
+ * @since 2.0.0
1197
+ */
640
1198
  <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): [init: Array<A>, rest: Array<A>];
641
1199
  };
642
1200
  /**
@@ -655,7 +1213,37 @@ export declare const span: {
655
1213
  * @since 2.0.0
656
1214
  */
657
1215
  export declare const drop: {
1216
+ /**
1217
+ * Drop a max number of elements from the start of an `Iterable`, creating a new `Array`.
1218
+ *
1219
+ * **Note**. `n` is normalized to a non negative integer.
1220
+ *
1221
+ * @example
1222
+ * import { Array } from "effect"
1223
+ *
1224
+ * const numbers = [1, 2, 3, 4, 5]
1225
+ * const result = Array.drop(numbers, 2)
1226
+ * assert.deepStrictEqual(result, [3, 4, 5])
1227
+ *
1228
+ * @category getters
1229
+ * @since 2.0.0
1230
+ */
658
1231
  (n: number): <A>(self: Iterable<A>) => Array<A>;
1232
+ /**
1233
+ * Drop a max number of elements from the start of an `Iterable`, creating a new `Array`.
1234
+ *
1235
+ * **Note**. `n` is normalized to a non negative integer.
1236
+ *
1237
+ * @example
1238
+ * import { Array } from "effect"
1239
+ *
1240
+ * const numbers = [1, 2, 3, 4, 5]
1241
+ * const result = Array.drop(numbers, 2)
1242
+ * assert.deepStrictEqual(result, [3, 4, 5])
1243
+ *
1244
+ * @category getters
1245
+ * @since 2.0.0
1246
+ */
659
1247
  <A>(self: Iterable<A>, n: number): Array<A>;
660
1248
  };
661
1249
  /**
@@ -674,7 +1262,37 @@ export declare const drop: {
674
1262
  * @since 2.0.0
675
1263
  */
676
1264
  export declare const dropRight: {
1265
+ /**
1266
+ * Drop a max number of elements from the end of an `Iterable`, creating a new `Array`.
1267
+ *
1268
+ * **Note**. `n` is normalized to a non negative integer.
1269
+ *
1270
+ * @example
1271
+ * import { Array } from "effect"
1272
+ *
1273
+ * const numbers = [1, 2, 3, 4, 5]
1274
+ * const result = Array.dropRight(numbers, 2)
1275
+ * assert.deepStrictEqual(result, [1, 2, 3])
1276
+ *
1277
+ * @category getters
1278
+ * @since 2.0.0
1279
+ */
677
1280
  (n: number): <A>(self: Iterable<A>) => Array<A>;
1281
+ /**
1282
+ * Drop a max number of elements from the end of an `Iterable`, creating a new `Array`.
1283
+ *
1284
+ * **Note**. `n` is normalized to a non negative integer.
1285
+ *
1286
+ * @example
1287
+ * import { Array } from "effect"
1288
+ *
1289
+ * const numbers = [1, 2, 3, 4, 5]
1290
+ * const result = Array.dropRight(numbers, 2)
1291
+ * assert.deepStrictEqual(result, [1, 2, 3])
1292
+ *
1293
+ * @category getters
1294
+ * @since 2.0.0
1295
+ */
678
1296
  <A>(self: Iterable<A>, n: number): Array<A>;
679
1297
  };
680
1298
  /**
@@ -691,7 +1309,33 @@ export declare const dropRight: {
691
1309
  * @since 2.0.0
692
1310
  */
693
1311
  export declare const dropWhile: {
1312
+ /**
1313
+ * Remove the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
1314
+ *
1315
+ * @example
1316
+ * import { Array } from "effect"
1317
+ *
1318
+ * const numbers = [1, 2, 3, 4, 5]
1319
+ * const result = Array.dropWhile(numbers, x => x < 4)
1320
+ * assert.deepStrictEqual(result, [4, 5])
1321
+ *
1322
+ * @category getters
1323
+ * @since 2.0.0
1324
+ */
694
1325
  <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Array<A>;
1326
+ /**
1327
+ * Remove the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
1328
+ *
1329
+ * @example
1330
+ * import { Array } from "effect"
1331
+ *
1332
+ * const numbers = [1, 2, 3, 4, 5]
1333
+ * const result = Array.dropWhile(numbers, x => x < 4)
1334
+ * assert.deepStrictEqual(result, [4, 5])
1335
+ *
1336
+ * @category getters
1337
+ * @since 2.0.0
1338
+ */
695
1339
  <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Array<A>;
696
1340
  };
697
1341
  /**
@@ -708,7 +1352,33 @@ export declare const dropWhile: {
708
1352
  * @since 2.0.0
709
1353
  */
710
1354
  export declare const findFirstIndex: {
1355
+ /**
1356
+ * Return the first index for which a predicate holds.
1357
+ *
1358
+ * @example
1359
+ * import { Array, Option } from "effect"
1360
+ *
1361
+ * const numbers = [5, 3, 8, 9]
1362
+ * const result = Array.findFirstIndex(numbers, x => x > 5)
1363
+ * assert.deepStrictEqual(result, Option.some(2))
1364
+ *
1365
+ * @category elements
1366
+ * @since 2.0.0
1367
+ */
711
1368
  <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option<number>;
1369
+ /**
1370
+ * Return the first index for which a predicate holds.
1371
+ *
1372
+ * @example
1373
+ * import { Array, Option } from "effect"
1374
+ *
1375
+ * const numbers = [5, 3, 8, 9]
1376
+ * const result = Array.findFirstIndex(numbers, x => x > 5)
1377
+ * assert.deepStrictEqual(result, Option.some(2))
1378
+ *
1379
+ * @category elements
1380
+ * @since 2.0.0
1381
+ */
712
1382
  <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option<number>;
713
1383
  };
714
1384
  /**
@@ -725,7 +1395,33 @@ export declare const findFirstIndex: {
725
1395
  * @since 2.0.0
726
1396
  */
727
1397
  export declare const findLastIndex: {
1398
+ /**
1399
+ * Return the last index for which a predicate holds.
1400
+ *
1401
+ * @example
1402
+ * import { Array, Option } from "effect"
1403
+ *
1404
+ * const numbers = [1, 3, 8, 9]
1405
+ * const result = Array.findLastIndex(numbers, x => x < 5)
1406
+ * assert.deepStrictEqual(result, Option.some(1))
1407
+ *
1408
+ * @category elements
1409
+ * @since 2.0.0
1410
+ */
728
1411
  <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option<number>;
1412
+ /**
1413
+ * Return the last index for which a predicate holds.
1414
+ *
1415
+ * @example
1416
+ * import { Array, Option } from "effect"
1417
+ *
1418
+ * const numbers = [1, 3, 8, 9]
1419
+ * const result = Array.findLastIndex(numbers, x => x < 5)
1420
+ * assert.deepStrictEqual(result, Option.some(1))
1421
+ *
1422
+ * @category elements
1423
+ * @since 2.0.0
1424
+ */
729
1425
  <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option<number>;
730
1426
  };
731
1427
  /**
@@ -743,11 +1439,95 @@ export declare const findLastIndex: {
743
1439
  * @since 2.0.0
744
1440
  */
745
1441
  export declare const findFirst: {
1442
+ /**
1443
+ * Returns the first element that satisfies the specified
1444
+ * predicate, or `None` if no such element exists.
1445
+ *
1446
+ * @example
1447
+ * import { Array, Option } from "effect"
1448
+ *
1449
+ * const numbers = [1, 2, 3, 4, 5]
1450
+ * const result = Array.findFirst(numbers, x => x > 3)
1451
+ * assert.deepStrictEqual(result, Option.some(4))
1452
+ *
1453
+ * @category elements
1454
+ * @since 2.0.0
1455
+ */
746
1456
  <A, B>(f: (a: NoInfer<A>, i: number) => Option<B>): (self: Iterable<A>) => Option<B>;
1457
+ /**
1458
+ * Returns the first element that satisfies the specified
1459
+ * predicate, or `None` if no such element exists.
1460
+ *
1461
+ * @example
1462
+ * import { Array, Option } from "effect"
1463
+ *
1464
+ * const numbers = [1, 2, 3, 4, 5]
1465
+ * const result = Array.findFirst(numbers, x => x > 3)
1466
+ * assert.deepStrictEqual(result, Option.some(4))
1467
+ *
1468
+ * @category elements
1469
+ * @since 2.0.0
1470
+ */
747
1471
  <A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Option<B>;
1472
+ /**
1473
+ * Returns the first element that satisfies the specified
1474
+ * predicate, or `None` if no such element exists.
1475
+ *
1476
+ * @example
1477
+ * import { Array, Option } from "effect"
1478
+ *
1479
+ * const numbers = [1, 2, 3, 4, 5]
1480
+ * const result = Array.findFirst(numbers, x => x > 3)
1481
+ * assert.deepStrictEqual(result, Option.some(4))
1482
+ *
1483
+ * @category elements
1484
+ * @since 2.0.0
1485
+ */
748
1486
  <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option<A>;
1487
+ /**
1488
+ * Returns the first element that satisfies the specified
1489
+ * predicate, or `None` if no such element exists.
1490
+ *
1491
+ * @example
1492
+ * import { Array, Option } from "effect"
1493
+ *
1494
+ * const numbers = [1, 2, 3, 4, 5]
1495
+ * const result = Array.findFirst(numbers, x => x > 3)
1496
+ * assert.deepStrictEqual(result, Option.some(4))
1497
+ *
1498
+ * @category elements
1499
+ * @since 2.0.0
1500
+ */
749
1501
  <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option<B>): Option<B>;
1502
+ /**
1503
+ * Returns the first element that satisfies the specified
1504
+ * predicate, or `None` if no such element exists.
1505
+ *
1506
+ * @example
1507
+ * import { Array, Option } from "effect"
1508
+ *
1509
+ * const numbers = [1, 2, 3, 4, 5]
1510
+ * const result = Array.findFirst(numbers, x => x > 3)
1511
+ * assert.deepStrictEqual(result, Option.some(4))
1512
+ *
1513
+ * @category elements
1514
+ * @since 2.0.0
1515
+ */
750
1516
  <A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Option<B>;
1517
+ /**
1518
+ * Returns the first element that satisfies the specified
1519
+ * predicate, or `None` if no such element exists.
1520
+ *
1521
+ * @example
1522
+ * import { Array, Option } from "effect"
1523
+ *
1524
+ * const numbers = [1, 2, 3, 4, 5]
1525
+ * const result = Array.findFirst(numbers, x => x > 3)
1526
+ * assert.deepStrictEqual(result, Option.some(4))
1527
+ *
1528
+ * @category elements
1529
+ * @since 2.0.0
1530
+ */
751
1531
  <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option<A>;
752
1532
  };
753
1533
  /**
@@ -765,11 +1545,95 @@ export declare const findFirst: {
765
1545
  * @since 2.0.0
766
1546
  */
767
1547
  export declare const findLast: {
1548
+ /**
1549
+ * Finds the last element in an iterable collection that satisfies the given predicate or refinement.
1550
+ * Returns an `Option` containing the found element, or `Option.none` if no element matches.
1551
+ *
1552
+ * @example
1553
+ * import { Array, Option } from "effect"
1554
+ *
1555
+ * const numbers = [1, 2, 3, 4, 5]
1556
+ * const result = Array.findLast(numbers, n => n % 2 === 0)
1557
+ * assert.deepStrictEqual(result, Option.some(4))
1558
+ *
1559
+ * @category elements
1560
+ * @since 2.0.0
1561
+ */
768
1562
  <A, B>(f: (a: NoInfer<A>, i: number) => Option<B>): (self: Iterable<A>) => Option<B>;
1563
+ /**
1564
+ * Finds the last element in an iterable collection that satisfies the given predicate or refinement.
1565
+ * Returns an `Option` containing the found element, or `Option.none` if no element matches.
1566
+ *
1567
+ * @example
1568
+ * import { Array, Option } from "effect"
1569
+ *
1570
+ * const numbers = [1, 2, 3, 4, 5]
1571
+ * const result = Array.findLast(numbers, n => n % 2 === 0)
1572
+ * assert.deepStrictEqual(result, Option.some(4))
1573
+ *
1574
+ * @category elements
1575
+ * @since 2.0.0
1576
+ */
769
1577
  <A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Option<B>;
1578
+ /**
1579
+ * Finds the last element in an iterable collection that satisfies the given predicate or refinement.
1580
+ * Returns an `Option` containing the found element, or `Option.none` if no element matches.
1581
+ *
1582
+ * @example
1583
+ * import { Array, Option } from "effect"
1584
+ *
1585
+ * const numbers = [1, 2, 3, 4, 5]
1586
+ * const result = Array.findLast(numbers, n => n % 2 === 0)
1587
+ * assert.deepStrictEqual(result, Option.some(4))
1588
+ *
1589
+ * @category elements
1590
+ * @since 2.0.0
1591
+ */
770
1592
  <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option<A>;
1593
+ /**
1594
+ * Finds the last element in an iterable collection that satisfies the given predicate or refinement.
1595
+ * Returns an `Option` containing the found element, or `Option.none` if no element matches.
1596
+ *
1597
+ * @example
1598
+ * import { Array, Option } from "effect"
1599
+ *
1600
+ * const numbers = [1, 2, 3, 4, 5]
1601
+ * const result = Array.findLast(numbers, n => n % 2 === 0)
1602
+ * assert.deepStrictEqual(result, Option.some(4))
1603
+ *
1604
+ * @category elements
1605
+ * @since 2.0.0
1606
+ */
771
1607
  <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option<B>): Option<B>;
1608
+ /**
1609
+ * Finds the last element in an iterable collection that satisfies the given predicate or refinement.
1610
+ * Returns an `Option` containing the found element, or `Option.none` if no element matches.
1611
+ *
1612
+ * @example
1613
+ * import { Array, Option } from "effect"
1614
+ *
1615
+ * const numbers = [1, 2, 3, 4, 5]
1616
+ * const result = Array.findLast(numbers, n => n % 2 === 0)
1617
+ * assert.deepStrictEqual(result, Option.some(4))
1618
+ *
1619
+ * @category elements
1620
+ * @since 2.0.0
1621
+ */
772
1622
  <A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Option<B>;
1623
+ /**
1624
+ * Finds the last element in an iterable collection that satisfies the given predicate or refinement.
1625
+ * Returns an `Option` containing the found element, or `Option.none` if no element matches.
1626
+ *
1627
+ * @example
1628
+ * import { Array, Option } from "effect"
1629
+ *
1630
+ * const numbers = [1, 2, 3, 4, 5]
1631
+ * const result = Array.findLast(numbers, n => n % 2 === 0)
1632
+ * assert.deepStrictEqual(result, Option.some(4))
1633
+ *
1634
+ * @category elements
1635
+ * @since 2.0.0
1636
+ */
773
1637
  <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option<A>;
774
1638
  };
775
1639
  /**
@@ -786,7 +1650,33 @@ export declare const findLast: {
786
1650
  * @since 2.0.0
787
1651
  */
788
1652
  export declare const insertAt: {
1653
+ /**
1654
+ * Insert an element at the specified index, creating a new `NonEmptyArray`,
1655
+ * or return `None` if the index is out of bounds.
1656
+ *
1657
+ * @example
1658
+ * import { Array, Option } from "effect"
1659
+ *
1660
+ * const letters = ['a', 'b', 'c', 'e']
1661
+ * const result = Array.insertAt(letters, 3, 'd')
1662
+ * assert.deepStrictEqual(result, Option.some(['a', 'b', 'c', 'd', 'e']))
1663
+ *
1664
+ * @since 2.0.0
1665
+ */
789
1666
  <B>(i: number, b: B): <A>(self: Iterable<A>) => Option<NonEmptyArray<A | B>>;
1667
+ /**
1668
+ * Insert an element at the specified index, creating a new `NonEmptyArray`,
1669
+ * or return `None` if the index is out of bounds.
1670
+ *
1671
+ * @example
1672
+ * import { Array, Option } from "effect"
1673
+ *
1674
+ * const letters = ['a', 'b', 'c', 'e']
1675
+ * const result = Array.insertAt(letters, 3, 'd')
1676
+ * assert.deepStrictEqual(result, Option.some(['a', 'b', 'c', 'd', 'e']))
1677
+ *
1678
+ * @since 2.0.0
1679
+ */
790
1680
  <A, B>(self: Iterable<A>, i: number, b: B): Option<NonEmptyArray<A | B>>;
791
1681
  };
792
1682
  /**
@@ -803,7 +1693,33 @@ export declare const insertAt: {
803
1693
  * @since 2.0.0
804
1694
  */
805
1695
  export declare const replace: {
1696
+ /**
1697
+ * Change the element at the specified index, creating a new `Array`,
1698
+ * or return a copy of the input if the index is out of bounds.
1699
+ *
1700
+ * @example
1701
+ * import { Array } from "effect"
1702
+ *
1703
+ * const letters = ['a', 'b', 'c', 'd']
1704
+ * const result = Array.replace(letters, 1, 'z')
1705
+ * assert.deepStrictEqual(result, ['a', 'z', 'c', 'd'])
1706
+ *
1707
+ * @since 2.0.0
1708
+ */
806
1709
  <B>(i: number, b: B): <A, S extends Iterable<A> = Iterable<A>>(self: S) => ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>;
1710
+ /**
1711
+ * Change the element at the specified index, creating a new `Array`,
1712
+ * or return a copy of the input if the index is out of bounds.
1713
+ *
1714
+ * @example
1715
+ * import { Array } from "effect"
1716
+ *
1717
+ * const letters = ['a', 'b', 'c', 'd']
1718
+ * const result = Array.replace(letters, 1, 'z')
1719
+ * assert.deepStrictEqual(result, ['a', 'z', 'c', 'd'])
1720
+ *
1721
+ * @since 2.0.0
1722
+ */
807
1723
  <A, B, S extends Iterable<A> = Iterable<A>>(self: S, i: number, b: B): ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>;
808
1724
  };
809
1725
  /**
@@ -819,7 +1735,31 @@ export declare const replace: {
819
1735
  * @since 2.0.0
820
1736
  */
821
1737
  export declare const replaceOption: {
1738
+ /**
1739
+ * Replaces an element in an array with the given value, returning an option of the updated array.
1740
+ *
1741
+ * @example
1742
+ * import { Array, Option } from "effect"
1743
+ *
1744
+ * const numbers = [1, 2, 3]
1745
+ * const result = Array.replaceOption(numbers, 1, 4)
1746
+ * assert.deepStrictEqual(result, Option.some([1, 4, 3]))
1747
+ *
1748
+ * @since 2.0.0
1749
+ */
822
1750
  <B>(i: number, b: B): <A, S extends Iterable<A> = Iterable<A>>(self: S) => Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>;
1751
+ /**
1752
+ * Replaces an element in an array with the given value, returning an option of the updated array.
1753
+ *
1754
+ * @example
1755
+ * import { Array, Option } from "effect"
1756
+ *
1757
+ * const numbers = [1, 2, 3]
1758
+ * const result = Array.replaceOption(numbers, 1, 4)
1759
+ * assert.deepStrictEqual(result, Option.some([1, 4, 3]))
1760
+ *
1761
+ * @since 2.0.0
1762
+ */
823
1763
  <A, B, S extends Iterable<A> = Iterable<A>>(self: S, i: number, b: B): Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>;
824
1764
  };
825
1765
  /**
@@ -836,7 +1776,33 @@ export declare const replaceOption: {
836
1776
  * @since 2.0.0
837
1777
  */
838
1778
  export declare const modify: {
1779
+ /**
1780
+ * Apply a function to the element at the specified index, creating a new `Array`,
1781
+ * or return a copy of the input if the index is out of bounds.
1782
+ *
1783
+ * @example
1784
+ * import { Array } from "effect"
1785
+ *
1786
+ * const numbers = [1, 2, 3, 4]
1787
+ * const result = Array.modify(numbers, 2, (n) => n * 2)
1788
+ * assert.deepStrictEqual(result, [1, 2, 6, 4])
1789
+ *
1790
+ * @since 2.0.0
1791
+ */
839
1792
  <A, B, S extends Iterable<A> = Iterable<A>>(i: number, f: (a: ReadonlyArray.Infer<S>) => B): (self: S) => ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>;
1793
+ /**
1794
+ * Apply a function to the element at the specified index, creating a new `Array`,
1795
+ * or return a copy of the input if the index is out of bounds.
1796
+ *
1797
+ * @example
1798
+ * import { Array } from "effect"
1799
+ *
1800
+ * const numbers = [1, 2, 3, 4]
1801
+ * const result = Array.modify(numbers, 2, (n) => n * 2)
1802
+ * assert.deepStrictEqual(result, [1, 2, 6, 4])
1803
+ *
1804
+ * @since 2.0.0
1805
+ */
840
1806
  <A, B, S extends Iterable<A> = Iterable<A>>(self: S, i: number, f: (a: ReadonlyArray.Infer<S>) => B): ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>;
841
1807
  };
842
1808
  /**
@@ -856,7 +1822,39 @@ export declare const modify: {
856
1822
  * @since 2.0.0
857
1823
  */
858
1824
  export declare const modifyOption: {
1825
+ /**
1826
+ * Apply a function to the element at the specified index, creating a new `Array`,
1827
+ * or return `None` if the index is out of bounds.
1828
+ *
1829
+ * @example
1830
+ * import { Array, Option } from "effect"
1831
+ *
1832
+ * const numbers = [1, 2, 3, 4]
1833
+ * const result = Array.modifyOption(numbers, 2, (n) => n * 2)
1834
+ * assert.deepStrictEqual(result, Option.some([1, 2, 6, 4]))
1835
+ *
1836
+ * const outOfBoundsResult = Array.modifyOption(numbers, 5, (n) => n * 2)
1837
+ * assert.deepStrictEqual(outOfBoundsResult, Option.none())
1838
+ *
1839
+ * @since 2.0.0
1840
+ */
859
1841
  <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>>;
1842
+ /**
1843
+ * Apply a function to the element at the specified index, creating a new `Array`,
1844
+ * or return `None` if the index is out of bounds.
1845
+ *
1846
+ * @example
1847
+ * import { Array, Option } from "effect"
1848
+ *
1849
+ * const numbers = [1, 2, 3, 4]
1850
+ * const result = Array.modifyOption(numbers, 2, (n) => n * 2)
1851
+ * assert.deepStrictEqual(result, Option.some([1, 2, 6, 4]))
1852
+ *
1853
+ * const outOfBoundsResult = Array.modifyOption(numbers, 5, (n) => n * 2)
1854
+ * assert.deepStrictEqual(outOfBoundsResult, Option.none())
1855
+ *
1856
+ * @since 2.0.0
1857
+ */
860
1858
  <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>>;
861
1859
  };
862
1860
  /**
@@ -876,7 +1874,39 @@ export declare const modifyOption: {
876
1874
  * @since 2.0.0
877
1875
  */
878
1876
  export declare const remove: {
1877
+ /**
1878
+ * Delete the element at the specified index, creating a new `Array`,
1879
+ * or return a copy of the input if the index is out of bounds.
1880
+ *
1881
+ * @example
1882
+ * import { Array } from "effect"
1883
+ *
1884
+ * const numbers = [1, 2, 3, 4]
1885
+ * const result = Array.remove(numbers, 2)
1886
+ * assert.deepStrictEqual(result, [1, 2, 4])
1887
+ *
1888
+ * const outOfBoundsResult = Array.remove(numbers, 5)
1889
+ * assert.deepStrictEqual(outOfBoundsResult, [1, 2, 3, 4])
1890
+ *
1891
+ * @since 2.0.0
1892
+ */
879
1893
  (i: number): <A>(self: Iterable<A>) => Array<A>;
1894
+ /**
1895
+ * Delete the element at the specified index, creating a new `Array`,
1896
+ * or return a copy of the input if the index is out of bounds.
1897
+ *
1898
+ * @example
1899
+ * import { Array } from "effect"
1900
+ *
1901
+ * const numbers = [1, 2, 3, 4]
1902
+ * const result = Array.remove(numbers, 2)
1903
+ * assert.deepStrictEqual(result, [1, 2, 4])
1904
+ *
1905
+ * const outOfBoundsResult = Array.remove(numbers, 5)
1906
+ * assert.deepStrictEqual(outOfBoundsResult, [1, 2, 3, 4])
1907
+ *
1908
+ * @since 2.0.0
1909
+ */
880
1910
  <A>(self: Iterable<A>, i: number): Array<A>;
881
1911
  };
882
1912
  /**
@@ -901,8 +1931,29 @@ export declare const reverse: <S extends Iterable<any> | NonEmptyReadonlyArray<a
901
1931
  * @since 2.0.0
902
1932
  */
903
1933
  export declare const sort: {
1934
+ /**
1935
+ * Create a new array with elements sorted in increasing order based on the specified comparator.
1936
+ * If the input is a `NonEmptyReadonlyArray`, the output will also be a `NonEmptyReadonlyArray`.
1937
+ *
1938
+ * @category sorting
1939
+ * @since 2.0.0
1940
+ */
904
1941
  <B>(O: Order.Order<B>): <A extends B, S extends ReadonlyArray<A> | Iterable<A>>(self: S) => ReadonlyArray.With<S, ReadonlyArray.Infer<S>>;
1942
+ /**
1943
+ * Create a new array with elements sorted in increasing order based on the specified comparator.
1944
+ * If the input is a `NonEmptyReadonlyArray`, the output will also be a `NonEmptyReadonlyArray`.
1945
+ *
1946
+ * @category sorting
1947
+ * @since 2.0.0
1948
+ */
905
1949
  <A extends B, B>(self: NonEmptyReadonlyArray<A>, O: Order.Order<B>): NonEmptyArray<A>;
1950
+ /**
1951
+ * Create a new array with elements sorted in increasing order based on the specified comparator.
1952
+ * If the input is a `NonEmptyReadonlyArray`, the output will also be a `NonEmptyReadonlyArray`.
1953
+ *
1954
+ * @category sorting
1955
+ * @since 2.0.0
1956
+ */
906
1957
  <A extends B, B>(self: Iterable<A>, O: Order.Order<B>): Array<A>;
907
1958
  };
908
1959
  /**
@@ -926,8 +1977,68 @@ export declare const sort: {
926
1977
  * @category elements
927
1978
  */
928
1979
  export declare const sortWith: {
1980
+ /**
1981
+ * Sorts an array based on a provided mapping function and order. The mapping
1982
+ * function transforms the elements into a value that can be compared, and the
1983
+ * order defines how those values should be sorted.
1984
+ *
1985
+ * @example
1986
+ * import { Array, Order } from "effect"
1987
+ *
1988
+ * const strings = ["aaa", "b", "cc"]
1989
+ * const result = Array.sortWith(strings, (s) => s.length, Order.number)
1990
+ * assert.deepStrictEqual(result, ["b", "cc", "aaa"])
1991
+ *
1992
+ * // Explanation:
1993
+ * // The array of strings is sorted based on their lengths. The mapping function `(s) => s.length`
1994
+ * // converts each string into its length, and the `Order.number` specifies that the lengths should
1995
+ * // be sorted in ascending order.
1996
+ *
1997
+ * @since 2.0.0
1998
+ * @category elements
1999
+ */
929
2000
  <S extends Iterable<any> | NonEmptyReadonlyArray<any>, B>(f: (a: ReadonlyArray.Infer<S>) => B, order: Order.Order<B>): (self: S) => ReadonlyArray.With<S, ReadonlyArray.Infer<S>>;
2001
+ /**
2002
+ * Sorts an array based on a provided mapping function and order. The mapping
2003
+ * function transforms the elements into a value that can be compared, and the
2004
+ * order defines how those values should be sorted.
2005
+ *
2006
+ * @example
2007
+ * import { Array, Order } from "effect"
2008
+ *
2009
+ * const strings = ["aaa", "b", "cc"]
2010
+ * const result = Array.sortWith(strings, (s) => s.length, Order.number)
2011
+ * assert.deepStrictEqual(result, ["b", "cc", "aaa"])
2012
+ *
2013
+ * // Explanation:
2014
+ * // The array of strings is sorted based on their lengths. The mapping function `(s) => s.length`
2015
+ * // converts each string into its length, and the `Order.number` specifies that the lengths should
2016
+ * // be sorted in ascending order.
2017
+ *
2018
+ * @since 2.0.0
2019
+ * @category elements
2020
+ */
930
2021
  <A, B>(self: NonEmptyReadonlyArray<A>, f: (a: A) => B, O: Order.Order<B>): NonEmptyArray<A>;
2022
+ /**
2023
+ * Sorts an array based on a provided mapping function and order. The mapping
2024
+ * function transforms the elements into a value that can be compared, and the
2025
+ * order defines how those values should be sorted.
2026
+ *
2027
+ * @example
2028
+ * import { Array, Order } from "effect"
2029
+ *
2030
+ * const strings = ["aaa", "b", "cc"]
2031
+ * const result = Array.sortWith(strings, (s) => s.length, Order.number)
2032
+ * assert.deepStrictEqual(result, ["b", "cc", "aaa"])
2033
+ *
2034
+ * // Explanation:
2035
+ * // The array of strings is sorted based on their lengths. The mapping function `(s) => s.length`
2036
+ * // converts each string into its length, and the `Order.number` specifies that the lengths should
2037
+ * // be sorted in ascending order.
2038
+ *
2039
+ * @since 2.0.0
2040
+ * @category elements
2041
+ */
931
2042
  <A, B>(self: Iterable<A>, f: (a: A) => B, order: Order.Order<B>): Array<A>;
932
2043
  };
933
2044
  /**
@@ -980,9 +2091,73 @@ export declare const sortBy: <S extends Iterable<any> | NonEmptyReadonlyArray<an
980
2091
  * @since 2.0.0
981
2092
  */
982
2093
  export declare const zip: {
2094
+ /**
2095
+ * Takes two `Iterable`s and returns an `Array` of corresponding pairs.
2096
+ * If one input `Iterable` is short, excess elements of the
2097
+ * longer `Iterable` are discarded.
2098
+ *
2099
+ * @example
2100
+ * import { Array } from "effect"
2101
+ *
2102
+ * const array1 = [1, 2, 3]
2103
+ * const array2 = ['a', 'b']
2104
+ * const result = Array.zip(array1, array2)
2105
+ * assert.deepStrictEqual(result, [[1, 'a'], [2, 'b']])
2106
+ *
2107
+ * @category zipping
2108
+ * @since 2.0.0
2109
+ */
983
2110
  <B>(that: NonEmptyReadonlyArray<B>): <A>(self: NonEmptyReadonlyArray<A>) => NonEmptyArray<[A, B]>;
2111
+ /**
2112
+ * Takes two `Iterable`s and returns an `Array` of corresponding pairs.
2113
+ * If one input `Iterable` is short, excess elements of the
2114
+ * longer `Iterable` are discarded.
2115
+ *
2116
+ * @example
2117
+ * import { Array } from "effect"
2118
+ *
2119
+ * const array1 = [1, 2, 3]
2120
+ * const array2 = ['a', 'b']
2121
+ * const result = Array.zip(array1, array2)
2122
+ * assert.deepStrictEqual(result, [[1, 'a'], [2, 'b']])
2123
+ *
2124
+ * @category zipping
2125
+ * @since 2.0.0
2126
+ */
984
2127
  <B>(that: Iterable<B>): <A>(self: Iterable<A>) => Array<[A, B]>;
2128
+ /**
2129
+ * Takes two `Iterable`s and returns an `Array` of corresponding pairs.
2130
+ * If one input `Iterable` is short, excess elements of the
2131
+ * longer `Iterable` are discarded.
2132
+ *
2133
+ * @example
2134
+ * import { Array } from "effect"
2135
+ *
2136
+ * const array1 = [1, 2, 3]
2137
+ * const array2 = ['a', 'b']
2138
+ * const result = Array.zip(array1, array2)
2139
+ * assert.deepStrictEqual(result, [[1, 'a'], [2, 'b']])
2140
+ *
2141
+ * @category zipping
2142
+ * @since 2.0.0
2143
+ */
985
2144
  <A, B>(self: NonEmptyReadonlyArray<A>, that: NonEmptyReadonlyArray<B>): NonEmptyArray<[A, B]>;
2145
+ /**
2146
+ * Takes two `Iterable`s and returns an `Array` of corresponding pairs.
2147
+ * If one input `Iterable` is short, excess elements of the
2148
+ * longer `Iterable` are discarded.
2149
+ *
2150
+ * @example
2151
+ * import { Array } from "effect"
2152
+ *
2153
+ * const array1 = [1, 2, 3]
2154
+ * const array2 = ['a', 'b']
2155
+ * const result = Array.zip(array1, array2)
2156
+ * assert.deepStrictEqual(result, [[1, 'a'], [2, 'b']])
2157
+ *
2158
+ * @category zipping
2159
+ * @since 2.0.0
2160
+ */
986
2161
  <A, B>(self: Iterable<A>, that: Iterable<B>): Array<[A, B]>;
987
2162
  };
988
2163
  /**
@@ -1001,9 +2176,69 @@ export declare const zip: {
1001
2176
  * @since 2.0.0
1002
2177
  */
1003
2178
  export declare const zipWith: {
2179
+ /**
2180
+ * Apply a function to pairs of elements at the same index in two `Iterable`s, collecting the results in a new `Array`. If one
2181
+ * input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
2182
+ *
2183
+ * @example
2184
+ * import { Array } from "effect"
2185
+ *
2186
+ * const array1 = [1, 2, 3]
2187
+ * const array2 = [4, 5, 6]
2188
+ * const result = Array.zipWith(array1, array2, (a, b) => a + b)
2189
+ * assert.deepStrictEqual(result, [5, 7, 9])
2190
+ *
2191
+ * @category zipping
2192
+ * @since 2.0.0
2193
+ */
1004
2194
  <B, A, C>(that: NonEmptyReadonlyArray<B>, f: (a: A, b: B) => C): (self: NonEmptyReadonlyArray<A>) => NonEmptyArray<C>;
2195
+ /**
2196
+ * Apply a function to pairs of elements at the same index in two `Iterable`s, collecting the results in a new `Array`. If one
2197
+ * input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
2198
+ *
2199
+ * @example
2200
+ * import { Array } from "effect"
2201
+ *
2202
+ * const array1 = [1, 2, 3]
2203
+ * const array2 = [4, 5, 6]
2204
+ * const result = Array.zipWith(array1, array2, (a, b) => a + b)
2205
+ * assert.deepStrictEqual(result, [5, 7, 9])
2206
+ *
2207
+ * @category zipping
2208
+ * @since 2.0.0
2209
+ */
1005
2210
  <B, A, C>(that: Iterable<B>, f: (a: A, b: B) => C): (self: Iterable<A>) => Array<C>;
2211
+ /**
2212
+ * Apply a function to pairs of elements at the same index in two `Iterable`s, collecting the results in a new `Array`. If one
2213
+ * input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
2214
+ *
2215
+ * @example
2216
+ * import { Array } from "effect"
2217
+ *
2218
+ * const array1 = [1, 2, 3]
2219
+ * const array2 = [4, 5, 6]
2220
+ * const result = Array.zipWith(array1, array2, (a, b) => a + b)
2221
+ * assert.deepStrictEqual(result, [5, 7, 9])
2222
+ *
2223
+ * @category zipping
2224
+ * @since 2.0.0
2225
+ */
1006
2226
  <A, B, C>(self: NonEmptyReadonlyArray<A>, that: NonEmptyReadonlyArray<B>, f: (a: A, b: B) => C): NonEmptyArray<C>;
2227
+ /**
2228
+ * Apply a function to pairs of elements at the same index in two `Iterable`s, collecting the results in a new `Array`. If one
2229
+ * input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
2230
+ *
2231
+ * @example
2232
+ * import { Array } from "effect"
2233
+ *
2234
+ * const array1 = [1, 2, 3]
2235
+ * const array2 = [4, 5, 6]
2236
+ * const result = Array.zipWith(array1, array2, (a, b) => a + b)
2237
+ * assert.deepStrictEqual(result, [5, 7, 9])
2238
+ *
2239
+ * @category zipping
2240
+ * @since 2.0.0
2241
+ */
1007
2242
  <B, A, C>(self: Iterable<A>, that: Iterable<B>, f: (a: A, b: B) => C): Array<C>;
1008
2243
  };
1009
2244
  /**
@@ -1032,8 +2267,47 @@ export declare const unzip: <S extends Iterable<readonly [any, any]> | NonEmptyR
1032
2267
  * @since 2.0.0
1033
2268
  */
1034
2269
  export declare const intersperse: {
2270
+ /**
2271
+ * Places an element in between members of an `Iterable`.
2272
+ * If the input is a non-empty array, the result is also a non-empty array.
2273
+ *
2274
+ * @example
2275
+ * import { Array } from "effect"
2276
+ *
2277
+ * const numbers = [1, 2, 3]
2278
+ * const result = Array.intersperse(numbers, 0)
2279
+ * assert.deepStrictEqual(result, [1, 0, 2, 0, 3])
2280
+ *
2281
+ * @since 2.0.0
2282
+ */
1035
2283
  <B>(middle: B): <S extends Iterable<any>>(self: S) => ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>;
2284
+ /**
2285
+ * Places an element in between members of an `Iterable`.
2286
+ * If the input is a non-empty array, the result is also a non-empty array.
2287
+ *
2288
+ * @example
2289
+ * import { Array } from "effect"
2290
+ *
2291
+ * const numbers = [1, 2, 3]
2292
+ * const result = Array.intersperse(numbers, 0)
2293
+ * assert.deepStrictEqual(result, [1, 0, 2, 0, 3])
2294
+ *
2295
+ * @since 2.0.0
2296
+ */
1036
2297
  <A, B>(self: NonEmptyReadonlyArray<A>, middle: B): NonEmptyArray<A | B>;
2298
+ /**
2299
+ * Places an element in between members of an `Iterable`.
2300
+ * If the input is a non-empty array, the result is also a non-empty array.
2301
+ *
2302
+ * @example
2303
+ * import { Array } from "effect"
2304
+ *
2305
+ * const numbers = [1, 2, 3]
2306
+ * const result = Array.intersperse(numbers, 0)
2307
+ * assert.deepStrictEqual(result, [1, 0, 2, 0, 3])
2308
+ *
2309
+ * @since 2.0.0
2310
+ */
1037
2311
  <A, B>(self: Iterable<A>, middle: B): Array<A | B>;
1038
2312
  };
1039
2313
  /**
@@ -1048,7 +2322,29 @@ export declare const intersperse: {
1048
2322
  * @since 2.0.0
1049
2323
  */
1050
2324
  export declare const modifyNonEmptyHead: {
2325
+ /**
2326
+ * Apply a function to the head, creating a new `NonEmptyReadonlyArray`.
2327
+ *
2328
+ * @example
2329
+ * import { Array } from "effect"
2330
+ *
2331
+ * const result = Array.modifyNonEmptyHead([1, 2, 3], n => n * 10)
2332
+ * assert.deepStrictEqual(result, [10, 2, 3])
2333
+ *
2334
+ * @since 2.0.0
2335
+ */
1051
2336
  <A, B>(f: (a: A) => B): (self: NonEmptyReadonlyArray<A>) => NonEmptyArray<A | B>;
2337
+ /**
2338
+ * Apply a function to the head, creating a new `NonEmptyReadonlyArray`.
2339
+ *
2340
+ * @example
2341
+ * import { Array } from "effect"
2342
+ *
2343
+ * const result = Array.modifyNonEmptyHead([1, 2, 3], n => n * 10)
2344
+ * assert.deepStrictEqual(result, [10, 2, 3])
2345
+ *
2346
+ * @since 2.0.0
2347
+ */
1052
2348
  <A, B>(self: NonEmptyReadonlyArray<A>, f: (a: A) => B): NonEmptyArray<A | B>;
1053
2349
  };
1054
2350
  /**
@@ -1063,7 +2359,29 @@ export declare const modifyNonEmptyHead: {
1063
2359
  * @since 2.0.0
1064
2360
  */
1065
2361
  export declare const setNonEmptyHead: {
2362
+ /**
2363
+ * Change the head, creating a new `NonEmptyReadonlyArray`.
2364
+ *
2365
+ * @example
2366
+ * import { Array } from "effect"
2367
+ *
2368
+ * const result = Array.setNonEmptyHead([1, 2, 3], 10)
2369
+ * assert.deepStrictEqual(result, [10, 2, 3])
2370
+ *
2371
+ * @since 2.0.0
2372
+ */
1066
2373
  <B>(b: B): <A>(self: NonEmptyReadonlyArray<A>) => NonEmptyArray<A | B>;
2374
+ /**
2375
+ * Change the head, creating a new `NonEmptyReadonlyArray`.
2376
+ *
2377
+ * @example
2378
+ * import { Array } from "effect"
2379
+ *
2380
+ * const result = Array.setNonEmptyHead([1, 2, 3], 10)
2381
+ * assert.deepStrictEqual(result, [10, 2, 3])
2382
+ *
2383
+ * @since 2.0.0
2384
+ */
1067
2385
  <A, B>(self: NonEmptyReadonlyArray<A>, b: B): NonEmptyArray<A | B>;
1068
2386
  };
1069
2387
  /**
@@ -1078,7 +2396,29 @@ export declare const setNonEmptyHead: {
1078
2396
  * @since 2.0.0
1079
2397
  */
1080
2398
  export declare const modifyNonEmptyLast: {
2399
+ /**
2400
+ * Apply a function to the last element, creating a new `NonEmptyReadonlyArray`.
2401
+ *
2402
+ * @example
2403
+ * import { Array } from "effect"
2404
+ *
2405
+ * const result = Array.modifyNonEmptyLast([1, 2, 3], n => n * 2)
2406
+ * assert.deepStrictEqual(result, [1, 2, 6])
2407
+ *
2408
+ * @since 2.0.0
2409
+ */
1081
2410
  <A, B>(f: (a: A) => B): (self: NonEmptyReadonlyArray<A>) => NonEmptyArray<A | B>;
2411
+ /**
2412
+ * Apply a function to the last element, creating a new `NonEmptyReadonlyArray`.
2413
+ *
2414
+ * @example
2415
+ * import { Array } from "effect"
2416
+ *
2417
+ * const result = Array.modifyNonEmptyLast([1, 2, 3], n => n * 2)
2418
+ * assert.deepStrictEqual(result, [1, 2, 6])
2419
+ *
2420
+ * @since 2.0.0
2421
+ */
1082
2422
  <A, B>(self: NonEmptyReadonlyArray<A>, f: (a: A) => B): NonEmptyArray<A | B>;
1083
2423
  };
1084
2424
  /**
@@ -1093,7 +2433,29 @@ export declare const modifyNonEmptyLast: {
1093
2433
  * @since 2.0.0
1094
2434
  */
1095
2435
  export declare const setNonEmptyLast: {
2436
+ /**
2437
+ * Change the last element, creating a new `NonEmptyReadonlyArray`.
2438
+ *
2439
+ * @example
2440
+ * import { Array } from "effect"
2441
+ *
2442
+ * const result = Array.setNonEmptyLast([1, 2, 3], 4)
2443
+ * assert.deepStrictEqual(result, [1, 2, 4])
2444
+ *
2445
+ * @since 2.0.0
2446
+ */
1096
2447
  <B>(b: B): <A>(self: NonEmptyReadonlyArray<A>) => NonEmptyArray<A | B>;
2448
+ /**
2449
+ * Change the last element, creating a new `NonEmptyReadonlyArray`.
2450
+ *
2451
+ * @example
2452
+ * import { Array } from "effect"
2453
+ *
2454
+ * const result = Array.setNonEmptyLast([1, 2, 3], 4)
2455
+ * assert.deepStrictEqual(result, [1, 2, 4])
2456
+ *
2457
+ * @since 2.0.0
2458
+ */
1097
2459
  <A, B>(self: NonEmptyReadonlyArray<A>, b: B): NonEmptyArray<A | B>;
1098
2460
  };
1099
2461
  /**
@@ -1110,8 +2472,47 @@ export declare const setNonEmptyLast: {
1110
2472
  * @since 2.0.0
1111
2473
  */
1112
2474
  export declare const rotate: {
2475
+ /**
2476
+ * Rotate an `Iterable` by `n` steps.
2477
+ * If the input is a non-empty array, the result is also a non-empty array.
2478
+ *
2479
+ * @example
2480
+ * import { Array } from "effect"
2481
+ *
2482
+ * const letters = ['a', 'b', 'c', 'd']
2483
+ * const result = Array.rotate(letters, 2)
2484
+ * assert.deepStrictEqual(result, ['c', 'd', 'a', 'b'])
2485
+ *
2486
+ * @since 2.0.0
2487
+ */
1113
2488
  (n: number): <S extends Iterable<any>>(self: S) => ReadonlyArray.With<S, ReadonlyArray.Infer<S>>;
2489
+ /**
2490
+ * Rotate an `Iterable` by `n` steps.
2491
+ * If the input is a non-empty array, the result is also a non-empty array.
2492
+ *
2493
+ * @example
2494
+ * import { Array } from "effect"
2495
+ *
2496
+ * const letters = ['a', 'b', 'c', 'd']
2497
+ * const result = Array.rotate(letters, 2)
2498
+ * assert.deepStrictEqual(result, ['c', 'd', 'a', 'b'])
2499
+ *
2500
+ * @since 2.0.0
2501
+ */
1114
2502
  <A>(self: NonEmptyReadonlyArray<A>, n: number): NonEmptyArray<A>;
2503
+ /**
2504
+ * Rotate an `Iterable` by `n` steps.
2505
+ * If the input is a non-empty array, the result is also a non-empty array.
2506
+ *
2507
+ * @example
2508
+ * import { Array } from "effect"
2509
+ *
2510
+ * const letters = ['a', 'b', 'c', 'd']
2511
+ * const result = Array.rotate(letters, 2)
2512
+ * assert.deepStrictEqual(result, ['c', 'd', 'a', 'b'])
2513
+ *
2514
+ * @since 2.0.0
2515
+ */
1115
2516
  <A>(self: Iterable<A>, n: number): Array<A>;
1116
2517
  };
1117
2518
  /**
@@ -1147,7 +2548,33 @@ export declare const containsWith: <A>(isEquivalent: (self: A, that: A) => boole
1147
2548
  * @since 2.0.0
1148
2549
  */
1149
2550
  export declare const contains: {
2551
+ /**
2552
+ * Returns a function that checks if a `ReadonlyArray` contains a given value using the default `Equivalence`.
2553
+ *
2554
+ * @example
2555
+ * import { Array } from "effect"
2556
+ *
2557
+ * const letters = ['a', 'b', 'c', 'd']
2558
+ * const result = Array.contains('c')(letters)
2559
+ * assert.deepStrictEqual(result, true)
2560
+ *
2561
+ * @category elements
2562
+ * @since 2.0.0
2563
+ */
1150
2564
  <A>(a: A): (self: Iterable<A>) => boolean;
2565
+ /**
2566
+ * Returns a function that checks if a `ReadonlyArray` contains a given value using the default `Equivalence`.
2567
+ *
2568
+ * @example
2569
+ * import { Array } from "effect"
2570
+ *
2571
+ * const letters = ['a', 'b', 'c', 'd']
2572
+ * const result = Array.contains('c')(letters)
2573
+ * assert.deepStrictEqual(result, true)
2574
+ *
2575
+ * @category elements
2576
+ * @since 2.0.0
2577
+ */
1151
2578
  <A>(self: Iterable<A>, a: A): boolean;
1152
2579
  };
1153
2580
  /**
@@ -1170,8 +2597,65 @@ export declare const contains: {
1170
2597
  * @since 2.0.0
1171
2598
  */
1172
2599
  export declare const chop: {
2600
+ /**
2601
+ * A useful recursion pattern for processing an `Iterable` to produce a new `Array`, often used for "chopping" up the input
2602
+ * `Iterable`. Typically chop is called with some function that will consume an initial prefix of the `Iterable` and produce a
2603
+ * value and the rest of the `Array`.
2604
+ *
2605
+ * @example
2606
+ * import { Array } from "effect"
2607
+ *
2608
+ * const numbers = [1, 2, 3, 4, 5]
2609
+ * const result = Array.chop(numbers, (as): [number, Array<number>] => [as[0] * 2, as.slice(1)])
2610
+ * assert.deepStrictEqual(result, [2, 4, 6, 8, 10])
2611
+ *
2612
+ * // Explanation:
2613
+ * // The `chopFunction` takes the first element of the array, doubles it, and then returns it along with the rest of the array.
2614
+ * // The `chop` function applies this `chopFunction` recursively to the input array `[1, 2, 3, 4, 5]`,
2615
+ * // resulting in a new array `[2, 4, 6, 8, 10]`.
2616
+ *
2617
+ * @since 2.0.0
2618
+ */
1173
2619
  <S extends Iterable<any>, B>(f: (as: NonEmptyReadonlyArray<ReadonlyArray.Infer<S>>) => readonly [B, ReadonlyArray<ReadonlyArray.Infer<S>>]): (self: S) => ReadonlyArray.With<S, ReadonlyArray.Infer<S>>;
2620
+ /**
2621
+ * A useful recursion pattern for processing an `Iterable` to produce a new `Array`, often used for "chopping" up the input
2622
+ * `Iterable`. Typically chop is called with some function that will consume an initial prefix of the `Iterable` and produce a
2623
+ * value and the rest of the `Array`.
2624
+ *
2625
+ * @example
2626
+ * import { Array } from "effect"
2627
+ *
2628
+ * const numbers = [1, 2, 3, 4, 5]
2629
+ * const result = Array.chop(numbers, (as): [number, Array<number>] => [as[0] * 2, as.slice(1)])
2630
+ * assert.deepStrictEqual(result, [2, 4, 6, 8, 10])
2631
+ *
2632
+ * // Explanation:
2633
+ * // The `chopFunction` takes the first element of the array, doubles it, and then returns it along with the rest of the array.
2634
+ * // The `chop` function applies this `chopFunction` recursively to the input array `[1, 2, 3, 4, 5]`,
2635
+ * // resulting in a new array `[2, 4, 6, 8, 10]`.
2636
+ *
2637
+ * @since 2.0.0
2638
+ */
1174
2639
  <A, B>(self: NonEmptyReadonlyArray<A>, f: (as: NonEmptyReadonlyArray<A>) => readonly [B, ReadonlyArray<A>]): NonEmptyArray<B>;
2640
+ /**
2641
+ * A useful recursion pattern for processing an `Iterable` to produce a new `Array`, often used for "chopping" up the input
2642
+ * `Iterable`. Typically chop is called with some function that will consume an initial prefix of the `Iterable` and produce a
2643
+ * value and the rest of the `Array`.
2644
+ *
2645
+ * @example
2646
+ * import { Array } from "effect"
2647
+ *
2648
+ * const numbers = [1, 2, 3, 4, 5]
2649
+ * const result = Array.chop(numbers, (as): [number, Array<number>] => [as[0] * 2, as.slice(1)])
2650
+ * assert.deepStrictEqual(result, [2, 4, 6, 8, 10])
2651
+ *
2652
+ * // Explanation:
2653
+ * // The `chopFunction` takes the first element of the array, doubles it, and then returns it along with the rest of the array.
2654
+ * // The `chop` function applies this `chopFunction` recursively to the input array `[1, 2, 3, 4, 5]`,
2655
+ * // resulting in a new array `[2, 4, 6, 8, 10]`.
2656
+ *
2657
+ * @since 2.0.0
2658
+ */
1175
2659
  <A, B>(self: Iterable<A>, f: (as: NonEmptyReadonlyArray<A>) => readonly [B, ReadonlyArray<A>]): Array<B>;
1176
2660
  };
1177
2661
  /**
@@ -1189,7 +2673,35 @@ export declare const chop: {
1189
2673
  * @since 2.0.0
1190
2674
  */
1191
2675
  export declare const splitAt: {
2676
+ /**
2677
+ * Splits an `Iterable` into two segments, with the first segment containing a maximum of `n` elements.
2678
+ * The value of `n` can be `0`.
2679
+ *
2680
+ * @example
2681
+ * import { Array } from "effect"
2682
+ *
2683
+ * const numbers = [1, 2, 3, 4, 5]
2684
+ * const result = Array.splitAt(numbers, 3)
2685
+ * assert.deepStrictEqual(result, [[1, 2, 3], [4, 5]])
2686
+ *
2687
+ * @category splitting
2688
+ * @since 2.0.0
2689
+ */
1192
2690
  (n: number): <A>(self: Iterable<A>) => [beforeIndex: Array<A>, fromIndex: Array<A>];
2691
+ /**
2692
+ * Splits an `Iterable` into two segments, with the first segment containing a maximum of `n` elements.
2693
+ * The value of `n` can be `0`.
2694
+ *
2695
+ * @example
2696
+ * import { Array } from "effect"
2697
+ *
2698
+ * const numbers = [1, 2, 3, 4, 5]
2699
+ * const result = Array.splitAt(numbers, 3)
2700
+ * assert.deepStrictEqual(result, [[1, 2, 3], [4, 5]])
2701
+ *
2702
+ * @category splitting
2703
+ * @since 2.0.0
2704
+ */
1193
2705
  <A>(self: Iterable<A>, n: number): [beforeIndex: Array<A>, fromIndex: Array<A>];
1194
2706
  };
1195
2707
  /**
@@ -1206,7 +2718,33 @@ export declare const splitAt: {
1206
2718
  * @since 2.0.0
1207
2719
  */
1208
2720
  export declare const splitNonEmptyAt: {
2721
+ /**
2722
+ * Splits a `NonEmptyReadonlyArray` into two segments, with the first segment containing a maximum of `n` elements.
2723
+ * The value of `n` must be `>= 1`.
2724
+ *
2725
+ * @example
2726
+ * import { Array } from "effect"
2727
+ *
2728
+ * const result = Array.splitNonEmptyAt(["a", "b", "c", "d", "e"], 3)
2729
+ * assert.deepStrictEqual(result, [["a", "b", "c"], ["d", "e"]])
2730
+ *
2731
+ * @category splitting
2732
+ * @since 2.0.0
2733
+ */
1209
2734
  (n: number): <A>(self: NonEmptyReadonlyArray<A>) => [beforeIndex: NonEmptyArray<A>, fromIndex: Array<A>];
2735
+ /**
2736
+ * Splits a `NonEmptyReadonlyArray` into two segments, with the first segment containing a maximum of `n` elements.
2737
+ * The value of `n` must be `>= 1`.
2738
+ *
2739
+ * @example
2740
+ * import { Array } from "effect"
2741
+ *
2742
+ * const result = Array.splitNonEmptyAt(["a", "b", "c", "d", "e"], 3)
2743
+ * assert.deepStrictEqual(result, [["a", "b", "c"], ["d", "e"]])
2744
+ *
2745
+ * @category splitting
2746
+ * @since 2.0.0
2747
+ */
1210
2748
  <A>(self: NonEmptyReadonlyArray<A>, n: number): [beforeIndex: NonEmptyArray<A>, fromIndex: Array<A>];
1211
2749
  };
1212
2750
  /**
@@ -1223,7 +2761,33 @@ export declare const splitNonEmptyAt: {
1223
2761
  * @category splitting
1224
2762
  */
1225
2763
  export declare const split: {
2764
+ /**
2765
+ * Splits this iterable into `n` equally sized arrays.
2766
+ *
2767
+ * @example
2768
+ * import { Array } from "effect"
2769
+ *
2770
+ * const numbers = [1, 2, 3, 4, 5, 6, 7, 8]
2771
+ * const result = Array.split(numbers, 3)
2772
+ * assert.deepStrictEqual(result, [[1, 2, 3], [4, 5, 6], [7, 8]])
2773
+ *
2774
+ * @since 2.0.0
2775
+ * @category splitting
2776
+ */
1226
2777
  (n: number): <A>(self: Iterable<A>) => Array<Array<A>>;
2778
+ /**
2779
+ * Splits this iterable into `n` equally sized arrays.
2780
+ *
2781
+ * @example
2782
+ * import { Array } from "effect"
2783
+ *
2784
+ * const numbers = [1, 2, 3, 4, 5, 6, 7, 8]
2785
+ * const result = Array.split(numbers, 3)
2786
+ * assert.deepStrictEqual(result, [[1, 2, 3], [4, 5, 6], [7, 8]])
2787
+ *
2788
+ * @since 2.0.0
2789
+ * @category splitting
2790
+ */
1227
2791
  <A>(self: Iterable<A>, n: number): Array<Array<A>>;
1228
2792
  };
1229
2793
  /**
@@ -1241,7 +2805,35 @@ export declare const split: {
1241
2805
  * @since 2.0.0
1242
2806
  */
1243
2807
  export declare const splitWhere: {
2808
+ /**
2809
+ * Splits this iterable on the first element that matches this predicate.
2810
+ * Returns a tuple containing two arrays: the first one is before the match, and the second one is from the match onward.
2811
+ *
2812
+ * @example
2813
+ * import { Array } from "effect"
2814
+ *
2815
+ * const numbers = [1, 2, 3, 4, 5]
2816
+ * const result = Array.splitWhere(numbers, n => n > 3)
2817
+ * assert.deepStrictEqual(result, [[1, 2, 3], [4, 5]])
2818
+ *
2819
+ * @category splitting
2820
+ * @since 2.0.0
2821
+ */
1244
2822
  <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => [beforeMatch: Array<A>, fromMatch: Array<A>];
2823
+ /**
2824
+ * Splits this iterable on the first element that matches this predicate.
2825
+ * Returns a tuple containing two arrays: the first one is before the match, and the second one is from the match onward.
2826
+ *
2827
+ * @example
2828
+ * import { Array } from "effect"
2829
+ *
2830
+ * const numbers = [1, 2, 3, 4, 5]
2831
+ * const result = Array.splitWhere(numbers, n => n > 3)
2832
+ * assert.deepStrictEqual(result, [[1, 2, 3], [4, 5]])
2833
+ *
2834
+ * @category splitting
2835
+ * @since 2.0.0
2836
+ */
1245
2837
  <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): [beforeMatch: Array<A>, fromMatch: Array<A>];
1246
2838
  };
1247
2839
  /**
@@ -1257,7 +2849,31 @@ export declare const splitWhere: {
1257
2849
  * @since 2.0.0
1258
2850
  */
1259
2851
  export declare const copy: {
2852
+ /**
2853
+ * Copies an array.
2854
+ *
2855
+ * @example
2856
+ * import { Array } from "effect"
2857
+ *
2858
+ * const numbers = [1, 2, 3]
2859
+ * const copy = Array.copy(numbers)
2860
+ * assert.deepStrictEqual(copy, [1, 2, 3])
2861
+ *
2862
+ * @since 2.0.0
2863
+ */
1260
2864
  <A>(self: NonEmptyReadonlyArray<A>): NonEmptyArray<A>;
2865
+ /**
2866
+ * Copies an array.
2867
+ *
2868
+ * @example
2869
+ * import { Array } from "effect"
2870
+ *
2871
+ * const numbers = [1, 2, 3]
2872
+ * const copy = Array.copy(numbers)
2873
+ * assert.deepStrictEqual(copy, [1, 2, 3])
2874
+ *
2875
+ * @since 2.0.0
2876
+ */
1261
2877
  <A>(self: ReadonlyArray<A>): Array<A>;
1262
2878
  };
1263
2879
  /**
@@ -1288,8 +2904,89 @@ export declare const copy: {
1288
2904
  * @since 2.0.0
1289
2905
  */
1290
2906
  export declare const chunksOf: {
2907
+ /**
2908
+ * Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of
2909
+ * the `Iterable`. Note that `chunksOf(n)([])` is `[]`, not `[[]]`. This is intentional, and is consistent with a recursive
2910
+ * definition of `chunksOf`; it satisfies the property that
2911
+ *
2912
+ * ```ts
2913
+ * chunksOf(n)(xs).concat(chunksOf(n)(ys)) == chunksOf(n)(xs.concat(ys)))
2914
+ * ```
2915
+ *
2916
+ * whenever `n` evenly divides the length of `self`.
2917
+ *
2918
+ * @example
2919
+ * import { Array } from "effect"
2920
+ *
2921
+ * const numbers = [1, 2, 3, 4, 5]
2922
+ * const result = Array.chunksOf(numbers, 2)
2923
+ * assert.deepStrictEqual(result, [[1, 2], [3, 4], [5]])
2924
+ *
2925
+ * // Explanation:
2926
+ * // The `chunksOf` function takes an array of numbers `[1, 2, 3, 4, 5]` and a number `2`.
2927
+ * // It splits the array into chunks of length 2. Since the array length is not evenly divisible by 2,
2928
+ * // the last chunk contains the remaining elements.
2929
+ * // The result is `[[1, 2], [3, 4], [5]]`.
2930
+ *
2931
+ * @category splitting
2932
+ * @since 2.0.0
2933
+ */
1291
2934
  (n: number): <S extends Iterable<any>>(self: S) => ReadonlyArray.With<S, NonEmptyArray<ReadonlyArray.Infer<S>>>;
2935
+ /**
2936
+ * Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of
2937
+ * the `Iterable`. Note that `chunksOf(n)([])` is `[]`, not `[[]]`. This is intentional, and is consistent with a recursive
2938
+ * definition of `chunksOf`; it satisfies the property that
2939
+ *
2940
+ * ```ts
2941
+ * chunksOf(n)(xs).concat(chunksOf(n)(ys)) == chunksOf(n)(xs.concat(ys)))
2942
+ * ```
2943
+ *
2944
+ * whenever `n` evenly divides the length of `self`.
2945
+ *
2946
+ * @example
2947
+ * import { Array } from "effect"
2948
+ *
2949
+ * const numbers = [1, 2, 3, 4, 5]
2950
+ * const result = Array.chunksOf(numbers, 2)
2951
+ * assert.deepStrictEqual(result, [[1, 2], [3, 4], [5]])
2952
+ *
2953
+ * // Explanation:
2954
+ * // The `chunksOf` function takes an array of numbers `[1, 2, 3, 4, 5]` and a number `2`.
2955
+ * // It splits the array into chunks of length 2. Since the array length is not evenly divisible by 2,
2956
+ * // the last chunk contains the remaining elements.
2957
+ * // The result is `[[1, 2], [3, 4], [5]]`.
2958
+ *
2959
+ * @category splitting
2960
+ * @since 2.0.0
2961
+ */
1292
2962
  <A>(self: NonEmptyReadonlyArray<A>, n: number): NonEmptyArray<NonEmptyArray<A>>;
2963
+ /**
2964
+ * Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of
2965
+ * the `Iterable`. Note that `chunksOf(n)([])` is `[]`, not `[[]]`. This is intentional, and is consistent with a recursive
2966
+ * definition of `chunksOf`; it satisfies the property that
2967
+ *
2968
+ * ```ts
2969
+ * chunksOf(n)(xs).concat(chunksOf(n)(ys)) == chunksOf(n)(xs.concat(ys)))
2970
+ * ```
2971
+ *
2972
+ * whenever `n` evenly divides the length of `self`.
2973
+ *
2974
+ * @example
2975
+ * import { Array } from "effect"
2976
+ *
2977
+ * const numbers = [1, 2, 3, 4, 5]
2978
+ * const result = Array.chunksOf(numbers, 2)
2979
+ * assert.deepStrictEqual(result, [[1, 2], [3, 4], [5]])
2980
+ *
2981
+ * // Explanation:
2982
+ * // The `chunksOf` function takes an array of numbers `[1, 2, 3, 4, 5]` and a number `2`.
2983
+ * // It splits the array into chunks of length 2. Since the array length is not evenly divisible by 2,
2984
+ * // the last chunk contains the remaining elements.
2985
+ * // The result is `[[1, 2], [3, 4], [5]]`.
2986
+ *
2987
+ * @category splitting
2988
+ * @since 2.0.0
2989
+ */
1293
2990
  <A>(self: Iterable<A>, n: number): Array<NonEmptyArray<A>>;
1294
2991
  };
1295
2992
  /**
@@ -1305,7 +3002,31 @@ export declare const chunksOf: {
1305
3002
  * @since 2.0.0
1306
3003
  */
1307
3004
  export declare const groupWith: {
3005
+ /**
3006
+ * Group equal, consecutive elements of a `NonEmptyReadonlyArray` into `NonEmptyArray`s using the provided `isEquivalent` function.
3007
+ *
3008
+ * @example
3009
+ * import { Array } from "effect"
3010
+ *
3011
+ * const result = Array.groupWith(["a", "a", "b", "b", "b", "c", "a"], (x, y) => x === y)
3012
+ * assert.deepStrictEqual(result, [["a", "a"], ["b", "b", "b"], ["c"], ["a"]])
3013
+ *
3014
+ * @category grouping
3015
+ * @since 2.0.0
3016
+ */
1308
3017
  <A>(isEquivalent: (self: A, that: A) => boolean): (self: NonEmptyReadonlyArray<A>) => NonEmptyArray<NonEmptyArray<A>>;
3018
+ /**
3019
+ * Group equal, consecutive elements of a `NonEmptyReadonlyArray` into `NonEmptyArray`s using the provided `isEquivalent` function.
3020
+ *
3021
+ * @example
3022
+ * import { Array } from "effect"
3023
+ *
3024
+ * const result = Array.groupWith(["a", "a", "b", "b", "b", "c", "a"], (x, y) => x === y)
3025
+ * assert.deepStrictEqual(result, [["a", "a"], ["b", "b", "b"], ["c"], ["a"]])
3026
+ *
3027
+ * @category grouping
3028
+ * @since 2.0.0
3029
+ */
1309
3030
  <A>(self: NonEmptyReadonlyArray<A>, isEquivalent: (self: A, that: A) => boolean): NonEmptyArray<NonEmptyArray<A>>;
1310
3031
  };
1311
3032
  /**
@@ -1343,7 +3064,49 @@ export declare const group: <A>(self: NonEmptyReadonlyArray<A>) => NonEmptyArray
1343
3064
  * @since 2.0.0
1344
3065
  */
1345
3066
  export declare const groupBy: {
3067
+ /**
3068
+ * Splits an `Iterable` into sub-non-empty-arrays stored in an object, based on the result of calling a `string`-returning
3069
+ * function on each element, and grouping the results according to values returned
3070
+ *
3071
+ * @example
3072
+ * import { Array } from "effect"
3073
+ *
3074
+ * const people = [
3075
+ * { name: "Alice", group: "A" },
3076
+ * { name: "Bob", group: "B" },
3077
+ * { name: "Charlie", group: "A" }
3078
+ * ]
3079
+ * const result = Array.groupBy(people, person => person.group)
3080
+ * assert.deepStrictEqual(result, {
3081
+ * A: [{ name: "Alice", group: "A" }, { name: "Charlie", group: "A" }],
3082
+ * B: [{ name: "Bob", group: "B" }]
3083
+ * })
3084
+ *
3085
+ * @category grouping
3086
+ * @since 2.0.0
3087
+ */
1346
3088
  <A, K extends string | symbol>(f: (a: A) => K): (self: Iterable<A>) => Record<Record.ReadonlyRecord.NonLiteralKey<K>, NonEmptyArray<A>>;
3089
+ /**
3090
+ * Splits an `Iterable` into sub-non-empty-arrays stored in an object, based on the result of calling a `string`-returning
3091
+ * function on each element, and grouping the results according to values returned
3092
+ *
3093
+ * @example
3094
+ * import { Array } from "effect"
3095
+ *
3096
+ * const people = [
3097
+ * { name: "Alice", group: "A" },
3098
+ * { name: "Bob", group: "B" },
3099
+ * { name: "Charlie", group: "A" }
3100
+ * ]
3101
+ * const result = Array.groupBy(people, person => person.group)
3102
+ * assert.deepStrictEqual(result, {
3103
+ * A: [{ name: "Alice", group: "A" }, { name: "Charlie", group: "A" }],
3104
+ * B: [{ name: "Bob", group: "B" }]
3105
+ * })
3106
+ *
3107
+ * @category grouping
3108
+ * @since 2.0.0
3109
+ */
1347
3110
  <A, K extends string | symbol>(self: Iterable<A>, f: (a: A) => K): Record<Record.ReadonlyRecord.NonLiteralKey<K>, NonEmptyArray<A>>;
1348
3111
  };
1349
3112
  /**
@@ -1360,9 +3123,61 @@ export declare const groupBy: {
1360
3123
  * @since 2.0.0
1361
3124
  */
1362
3125
  export declare const unionWith: {
3126
+ /**
3127
+ * Calculates the union of two arrays using the provided equivalence relation.
3128
+ *
3129
+ * @example
3130
+ * import { Array } from "effect"
3131
+ *
3132
+ * const array1 = [1, 2]
3133
+ * const array2 = [2, 3]
3134
+ * const union = Array.unionWith(array1, array2, (a, b) => a === b)
3135
+ * assert.deepStrictEqual(union, [1, 2, 3])
3136
+ *
3137
+ * @since 2.0.0
3138
+ */
1363
3139
  <S extends Iterable<any>, T extends Iterable<any>>(that: T, isEquivalent: (self: ReadonlyArray.Infer<S>, that: ReadonlyArray.Infer<T>) => boolean): (self: S) => ReadonlyArray.OrNonEmpty<S, T, ReadonlyArray.Infer<S> | ReadonlyArray.Infer<T>>;
3140
+ /**
3141
+ * Calculates the union of two arrays using the provided equivalence relation.
3142
+ *
3143
+ * @example
3144
+ * import { Array } from "effect"
3145
+ *
3146
+ * const array1 = [1, 2]
3147
+ * const array2 = [2, 3]
3148
+ * const union = Array.unionWith(array1, array2, (a, b) => a === b)
3149
+ * assert.deepStrictEqual(union, [1, 2, 3])
3150
+ *
3151
+ * @since 2.0.0
3152
+ */
1364
3153
  <A, B>(self: NonEmptyReadonlyArray<A>, that: Iterable<B>, isEquivalent: (self: A, that: B) => boolean): NonEmptyArray<A | B>;
3154
+ /**
3155
+ * Calculates the union of two arrays using the provided equivalence relation.
3156
+ *
3157
+ * @example
3158
+ * import { Array } from "effect"
3159
+ *
3160
+ * const array1 = [1, 2]
3161
+ * const array2 = [2, 3]
3162
+ * const union = Array.unionWith(array1, array2, (a, b) => a === b)
3163
+ * assert.deepStrictEqual(union, [1, 2, 3])
3164
+ *
3165
+ * @since 2.0.0
3166
+ */
1365
3167
  <A, B>(self: Iterable<A>, that: NonEmptyReadonlyArray<B>, isEquivalent: (self: A, that: B) => boolean): NonEmptyArray<A | B>;
3168
+ /**
3169
+ * Calculates the union of two arrays using the provided equivalence relation.
3170
+ *
3171
+ * @example
3172
+ * import { Array } from "effect"
3173
+ *
3174
+ * const array1 = [1, 2]
3175
+ * const array2 = [2, 3]
3176
+ * const union = Array.unionWith(array1, array2, (a, b) => a === b)
3177
+ * assert.deepStrictEqual(union, [1, 2, 3])
3178
+ *
3179
+ * @since 2.0.0
3180
+ */
1366
3181
  <A, B>(self: Iterable<A>, that: Iterable<B>, isEquivalent: (self: A, that: B) => boolean): Array<A | B>;
1367
3182
  };
1368
3183
  /**
@@ -1379,9 +3194,61 @@ export declare const unionWith: {
1379
3194
  * @since 2.0.0
1380
3195
  */
1381
3196
  export declare const union: {
3197
+ /**
3198
+ * Creates a union of two arrays, removing duplicates.
3199
+ *
3200
+ * @example
3201
+ * import { Array } from "effect"
3202
+ *
3203
+ * const array1 = [1, 2]
3204
+ * const array2 = [2, 3]
3205
+ * const result = Array.union(array1, array2)
3206
+ * assert.deepStrictEqual(result, [1, 2, 3])
3207
+ *
3208
+ * @since 2.0.0
3209
+ */
1382
3210
  <T extends Iterable<any>>(that: T): <S extends Iterable<any>>(self: S) => ReadonlyArray.OrNonEmpty<S, T, ReadonlyArray.Infer<S> | ReadonlyArray.Infer<T>>;
3211
+ /**
3212
+ * Creates a union of two arrays, removing duplicates.
3213
+ *
3214
+ * @example
3215
+ * import { Array } from "effect"
3216
+ *
3217
+ * const array1 = [1, 2]
3218
+ * const array2 = [2, 3]
3219
+ * const result = Array.union(array1, array2)
3220
+ * assert.deepStrictEqual(result, [1, 2, 3])
3221
+ *
3222
+ * @since 2.0.0
3223
+ */
1383
3224
  <A, B>(self: NonEmptyReadonlyArray<A>, that: ReadonlyArray<B>): NonEmptyArray<A | B>;
3225
+ /**
3226
+ * Creates a union of two arrays, removing duplicates.
3227
+ *
3228
+ * @example
3229
+ * import { Array } from "effect"
3230
+ *
3231
+ * const array1 = [1, 2]
3232
+ * const array2 = [2, 3]
3233
+ * const result = Array.union(array1, array2)
3234
+ * assert.deepStrictEqual(result, [1, 2, 3])
3235
+ *
3236
+ * @since 2.0.0
3237
+ */
1384
3238
  <A, B>(self: ReadonlyArray<A>, that: NonEmptyReadonlyArray<B>): NonEmptyArray<A | B>;
3239
+ /**
3240
+ * Creates a union of two arrays, removing duplicates.
3241
+ *
3242
+ * @example
3243
+ * import { Array } from "effect"
3244
+ *
3245
+ * const array1 = [1, 2]
3246
+ * const array2 = [2, 3]
3247
+ * const result = Array.union(array1, array2)
3248
+ * assert.deepStrictEqual(result, [1, 2, 3])
3249
+ *
3250
+ * @since 2.0.0
3251
+ */
1385
3252
  <A, B>(self: Iterable<A>, that: Iterable<B>): Array<A | B>;
1386
3253
  };
1387
3254
  /**
@@ -1418,7 +3285,35 @@ export declare const intersectionWith: <A>(isEquivalent: (self: A, that: A) => b
1418
3285
  * @since 2.0.0
1419
3286
  */
1420
3287
  export declare const intersection: {
3288
+ /**
3289
+ * Creates an `Array` of unique values that are included in all given `Iterable`s.
3290
+ * The order and references of result values are determined by the first `Iterable`.
3291
+ *
3292
+ * @example
3293
+ * import { Array } from "effect"
3294
+ *
3295
+ * const array1 = [1, 2, 3]
3296
+ * const array2 = [3, 4, 1]
3297
+ * const result = Array.intersection(array1, array2)
3298
+ * assert.deepStrictEqual(result, [1, 3])
3299
+ *
3300
+ * @since 2.0.0
3301
+ */
1421
3302
  <B>(that: Iterable<B>): <A>(self: Iterable<A>) => Array<A & B>;
3303
+ /**
3304
+ * Creates an `Array` of unique values that are included in all given `Iterable`s.
3305
+ * The order and references of result values are determined by the first `Iterable`.
3306
+ *
3307
+ * @example
3308
+ * import { Array } from "effect"
3309
+ *
3310
+ * const array1 = [1, 2, 3]
3311
+ * const array2 = [3, 4, 1]
3312
+ * const result = Array.intersection(array1, array2)
3313
+ * assert.deepStrictEqual(result, [1, 3])
3314
+ *
3315
+ * @since 2.0.0
3316
+ */
1422
3317
  <A, B>(self: Iterable<A>, that: Iterable<B>): Array<A & B>;
1423
3318
  };
1424
3319
  /**
@@ -1454,7 +3349,35 @@ export declare const differenceWith: <A>(isEquivalent: (self: A, that: A) => boo
1454
3349
  * @since 2.0.0
1455
3350
  */
1456
3351
  export declare const difference: {
3352
+ /**
3353
+ * Creates a `Array` of values not included in the other given `Iterable`.
3354
+ * The order and references of result values are determined by the first `Iterable`.
3355
+ *
3356
+ * @example
3357
+ * import { Array } from "effect"
3358
+ *
3359
+ * const array1 = [1, 2, 3]
3360
+ * const array2 = [2, 3, 4]
3361
+ * const difference = Array.difference(array1, array2)
3362
+ * assert.deepStrictEqual(difference, [1])
3363
+ *
3364
+ * @since 2.0.0
3365
+ */
1457
3366
  <A>(that: Iterable<A>): (self: Iterable<A>) => Array<A>;
3367
+ /**
3368
+ * Creates a `Array` of values not included in the other given `Iterable`.
3369
+ * The order and references of result values are determined by the first `Iterable`.
3370
+ *
3371
+ * @example
3372
+ * import { Array } from "effect"
3373
+ *
3374
+ * const array1 = [1, 2, 3]
3375
+ * const array2 = [2, 3, 4]
3376
+ * const difference = Array.difference(array1, array2)
3377
+ * assert.deepStrictEqual(difference, [1])
3378
+ *
3379
+ * @since 2.0.0
3380
+ */
1458
3381
  <A>(self: Iterable<A>, that: Iterable<A>): Array<A>;
1459
3382
  };
1460
3383
  /**
@@ -1499,7 +3422,15 @@ export declare namespace ReadonlyArray {
1499
3422
  * @since 2.0.0
1500
3423
  */
1501
3424
  export declare const map: {
3425
+ /**
3426
+ * @category mapping
3427
+ * @since 2.0.0
3428
+ */
1502
3429
  <S extends ReadonlyArray<any>, B>(f: (a: ReadonlyArray.Infer<S>, i: number) => B): (self: S) => ReadonlyArray.With<S, B>;
3430
+ /**
3431
+ * @category mapping
3432
+ * @since 2.0.0
3433
+ */
1503
3434
  <S extends ReadonlyArray<any>, B>(self: S, f: (a: ReadonlyArray.Infer<S>, i: number) => B): ReadonlyArray.With<S, B>;
1504
3435
  };
1505
3436
  /**
@@ -1509,8 +3440,26 @@ export declare const map: {
1509
3440
  * @since 2.0.0
1510
3441
  */
1511
3442
  export declare const flatMap: {
3443
+ /**
3444
+ * Applies a function to each element in an array and returns a new array containing the concatenated mapped elements.
3445
+ *
3446
+ * @category sequencing
3447
+ * @since 2.0.0
3448
+ */
1512
3449
  <S extends ReadonlyArray<any>, T extends ReadonlyArray<any>>(f: (a: ReadonlyArray.Infer<S>, i: number) => T): (self: S) => ReadonlyArray.AndNonEmpty<S, T, ReadonlyArray.Infer<T>>;
3450
+ /**
3451
+ * Applies a function to each element in an array and returns a new array containing the concatenated mapped elements.
3452
+ *
3453
+ * @category sequencing
3454
+ * @since 2.0.0
3455
+ */
1513
3456
  <A, B>(self: NonEmptyReadonlyArray<A>, f: (a: A, i: number) => NonEmptyReadonlyArray<B>): NonEmptyArray<B>;
3457
+ /**
3458
+ * Applies a function to each element in an array and returns a new array containing the concatenated mapped elements.
3459
+ *
3460
+ * @category sequencing
3461
+ * @since 2.0.0
3462
+ */
1514
3463
  <A, B>(self: ReadonlyArray<A>, f: (a: A, i: number) => ReadonlyArray<B>): Array<B>;
1515
3464
  };
1516
3465
  /**
@@ -1547,7 +3496,39 @@ export declare const flatten: <S extends ReadonlyArray<ReadonlyArray<any>>>(self
1547
3496
  * @since 2.0.0
1548
3497
  */
1549
3498
  export declare const filterMap: {
3499
+ /**
3500
+ * Applies a function to each element of the `Iterable` and filters based on the result, keeping the transformed values where the function returns `Some`.
3501
+ * This method combines filtering and mapping functionalities, allowing transformations and filtering of elements based on a single function pass.
3502
+ *
3503
+ * @example
3504
+ * import { Array, Option } from "effect";
3505
+ *
3506
+ * const data = [1, 2, 3, 4, 5];
3507
+ * const evenSquares = (x: number) => x % 2 === 0 ? Option.some(x * x) : Option.none();
3508
+ * const result = Array.filterMap(data, evenSquares);
3509
+ *
3510
+ * assert.deepStrictEqual(result, [4, 16]);
3511
+ *
3512
+ * @category filtering
3513
+ * @since 2.0.0
3514
+ */
1550
3515
  <A, B>(f: (a: A, i: number) => Option<B>): (self: Iterable<A>) => Array<B>;
3516
+ /**
3517
+ * Applies a function to each element of the `Iterable` and filters based on the result, keeping the transformed values where the function returns `Some`.
3518
+ * This method combines filtering and mapping functionalities, allowing transformations and filtering of elements based on a single function pass.
3519
+ *
3520
+ * @example
3521
+ * import { Array, Option } from "effect";
3522
+ *
3523
+ * const data = [1, 2, 3, 4, 5];
3524
+ * const evenSquares = (x: number) => x % 2 === 0 ? Option.some(x * x) : Option.none();
3525
+ * const result = Array.filterMap(data, evenSquares);
3526
+ *
3527
+ * assert.deepStrictEqual(result, [4, 16]);
3528
+ *
3529
+ * @category filtering
3530
+ * @since 2.0.0
3531
+ */
1551
3532
  <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option<B>): Array<B>;
1552
3533
  };
1553
3534
  /**
@@ -1568,7 +3549,41 @@ export declare const filterMap: {
1568
3549
  * @since 2.0.0
1569
3550
  */
1570
3551
  export declare const filterMapWhile: {
3552
+ /**
3553
+ * Applies a function to each element of the array and filters based on the result, stopping when a condition is not met.
3554
+ * This method combines filtering and mapping in a single pass, and short-circuits, i.e., stops processing, as soon as the function returns `None`.
3555
+ * This is useful when you need to transform an array but only up to the point where a certain condition holds true.
3556
+ *
3557
+ * @example
3558
+ * import { Array, Option } from "effect";
3559
+ *
3560
+ * const data = [2, 4, 5];
3561
+ * const toSquareTillOdd = (x: number) => x % 2 === 0 ? Option.some(x * x) : Option.none();
3562
+ * const result = Array.filterMapWhile(data, toSquareTillOdd);
3563
+ *
3564
+ * assert.deepStrictEqual(result, [4, 16]);
3565
+ *
3566
+ * @category filtering
3567
+ * @since 2.0.0
3568
+ */
1571
3569
  <A, B>(f: (a: A, i: number) => Option<B>): (self: Iterable<A>) => Array<B>;
3570
+ /**
3571
+ * Applies a function to each element of the array and filters based on the result, stopping when a condition is not met.
3572
+ * This method combines filtering and mapping in a single pass, and short-circuits, i.e., stops processing, as soon as the function returns `None`.
3573
+ * This is useful when you need to transform an array but only up to the point where a certain condition holds true.
3574
+ *
3575
+ * @example
3576
+ * import { Array, Option } from "effect";
3577
+ *
3578
+ * const data = [2, 4, 5];
3579
+ * const toSquareTillOdd = (x: number) => x % 2 === 0 ? Option.some(x * x) : Option.none();
3580
+ * const result = Array.filterMapWhile(data, toSquareTillOdd);
3581
+ *
3582
+ * assert.deepStrictEqual(result, [4, 16]);
3583
+ *
3584
+ * @category filtering
3585
+ * @since 2.0.0
3586
+ */
1572
3587
  <A, B>(self: Iterable<A>, f: (a: A, i: number) => Option<B>): Array<B>;
1573
3588
  };
1574
3589
  /**
@@ -1595,7 +3610,53 @@ export declare const filterMapWhile: {
1595
3610
  * @since 2.0.0
1596
3611
  */
1597
3612
  export declare const partitionMap: {
3613
+ /**
3614
+ * Applies a function to each element of the `Iterable`, categorizing the results into two separate arrays.
3615
+ * This function is particularly useful for operations where each element can result in two possible types,
3616
+ * and you want to separate these types into different collections. For instance, separating validation results
3617
+ * into successes and failures.
3618
+ *
3619
+ * @example
3620
+ * import { Array, Either } from "effect";
3621
+ *
3622
+ * const data = [1, 2, 3, 4, 5]
3623
+ * const isEven = (x: number) => x % 2 === 0
3624
+ * const partitioned = Array.partitionMap(data, x =>
3625
+ * isEven(x) ? Either.right(x) : Either.left(x)
3626
+ * )
3627
+ *
3628
+ * assert.deepStrictEqual(partitioned, [
3629
+ * [1, 3, 5],
3630
+ * [2, 4]
3631
+ * ])
3632
+ *
3633
+ * @category filtering
3634
+ * @since 2.0.0
3635
+ */
1598
3636
  <A, B, C>(f: (a: A, i: number) => array_<C, B>): (self: Iterable<A>) => [left: Array<B>, right: Array<C>];
3637
+ /**
3638
+ * Applies a function to each element of the `Iterable`, categorizing the results into two separate arrays.
3639
+ * This function is particularly useful for operations where each element can result in two possible types,
3640
+ * and you want to separate these types into different collections. For instance, separating validation results
3641
+ * into successes and failures.
3642
+ *
3643
+ * @example
3644
+ * import { Array, Either } from "effect";
3645
+ *
3646
+ * const data = [1, 2, 3, 4, 5]
3647
+ * const isEven = (x: number) => x % 2 === 0
3648
+ * const partitioned = Array.partitionMap(data, x =>
3649
+ * isEven(x) ? Either.right(x) : Either.left(x)
3650
+ * )
3651
+ *
3652
+ * assert.deepStrictEqual(partitioned, [
3653
+ * [1, 3, 5],
3654
+ * [2, 4]
3655
+ * ])
3656
+ *
3657
+ * @category filtering
3658
+ * @since 2.0.0
3659
+ */
1599
3660
  <A, B, C>(self: Iterable<A>, f: (a: A, i: number) => array_<C, B>): [left: Array<B>, right: Array<C>];
1600
3661
  };
1601
3662
  /**
@@ -1648,9 +3709,25 @@ export declare const getRights: <T extends Iterable<array_<any, any>>>(self: T)
1648
3709
  * @since 2.0.0
1649
3710
  */
1650
3711
  export declare const filter: {
3712
+ /**
3713
+ * @category filtering
3714
+ * @since 2.0.0
3715
+ */
1651
3716
  <A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Array<B>;
3717
+ /**
3718
+ * @category filtering
3719
+ * @since 2.0.0
3720
+ */
1652
3721
  <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Array<A>;
3722
+ /**
3723
+ * @category filtering
3724
+ * @since 2.0.0
3725
+ */
1653
3726
  <A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Array<B>;
3727
+ /**
3728
+ * @category filtering
3729
+ * @since 2.0.0
3730
+ */
1654
3731
  <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Array<A>;
1655
3732
  };
1656
3733
  /**
@@ -1660,9 +3737,33 @@ export declare const filter: {
1660
3737
  * @since 2.0.0
1661
3738
  */
1662
3739
  export declare const partition: {
3740
+ /**
3741
+ * Separate elements based on a predicate that also exposes the index of the element.
3742
+ *
3743
+ * @category filtering
3744
+ * @since 2.0.0
3745
+ */
1663
3746
  <A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => [excluded: Array<Exclude<A, B>>, satisfying: Array<B>];
3747
+ /**
3748
+ * Separate elements based on a predicate that also exposes the index of the element.
3749
+ *
3750
+ * @category filtering
3751
+ * @since 2.0.0
3752
+ */
1664
3753
  <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => [excluded: Array<A>, satisfying: Array<A>];
3754
+ /**
3755
+ * Separate elements based on a predicate that also exposes the index of the element.
3756
+ *
3757
+ * @category filtering
3758
+ * @since 2.0.0
3759
+ */
1665
3760
  <A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): [excluded: Array<Exclude<A, B>>, satisfying: Array<B>];
3761
+ /**
3762
+ * Separate elements based on a predicate that also exposes the index of the element.
3763
+ *
3764
+ * @category filtering
3765
+ * @since 2.0.0
3766
+ */
1666
3767
  <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): [excluded: Array<A>, satisfying: Array<A>];
1667
3768
  };
1668
3769
  /**
@@ -1693,7 +3794,33 @@ export declare const separate: <T extends Iterable<array_<any, any>>>(self: T) =
1693
3794
  * @since 2.0.0
1694
3795
  */
1695
3796
  export declare const reduce: {
3797
+ /**
3798
+ * Reduces an array from the left.
3799
+ *
3800
+ * @example
3801
+ * import { Array } from "effect"
3802
+ *
3803
+ * const numbers = [1, 2, 3]
3804
+ * const result = Array.reduce(numbers, 0, (acc, n) => acc + n)
3805
+ * assert.deepStrictEqual(result, 6)
3806
+ *
3807
+ * @category folding
3808
+ * @since 2.0.0
3809
+ */
1696
3810
  <B, A>(b: B, f: (b: B, a: A, i: number) => B): (self: Iterable<A>) => B;
3811
+ /**
3812
+ * Reduces an array from the left.
3813
+ *
3814
+ * @example
3815
+ * import { Array } from "effect"
3816
+ *
3817
+ * const numbers = [1, 2, 3]
3818
+ * const result = Array.reduce(numbers, 0, (acc, n) => acc + n)
3819
+ * assert.deepStrictEqual(result, 6)
3820
+ *
3821
+ * @category folding
3822
+ * @since 2.0.0
3823
+ */
1697
3824
  <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A, i: number) => B): B;
1698
3825
  };
1699
3826
  /**
@@ -1710,7 +3837,33 @@ export declare const reduce: {
1710
3837
  * @since 2.0.0
1711
3838
  */
1712
3839
  export declare const reduceRight: {
3840
+ /**
3841
+ * Reduces an array from the right.
3842
+ *
3843
+ * @example
3844
+ * import { Array } from "effect"
3845
+ *
3846
+ * const numbers = [1, 2, 3]
3847
+ * const result = Array.reduceRight(numbers, 0, (acc, n) => acc + n)
3848
+ * assert.deepStrictEqual(result, 6)
3849
+ *
3850
+ * @category folding
3851
+ * @since 2.0.0
3852
+ */
1713
3853
  <B, A>(b: B, f: (b: B, a: A, i: number) => B): (self: Iterable<A>) => B;
3854
+ /**
3855
+ * Reduces an array from the right.
3856
+ *
3857
+ * @example
3858
+ * import { Array } from "effect"
3859
+ *
3860
+ * const numbers = [1, 2, 3]
3861
+ * const result = Array.reduceRight(numbers, 0, (acc, n) => acc + n)
3862
+ * assert.deepStrictEqual(result, 6)
3863
+ *
3864
+ * @category folding
3865
+ * @since 2.0.0
3866
+ */
1714
3867
  <A, B>(self: Iterable<A>, b: B, f: (b: B, a: A, i: number) => B): B;
1715
3868
  };
1716
3869
  /**
@@ -1729,6 +3882,20 @@ export declare const reduceRight: {
1729
3882
  */
1730
3883
  export declare const liftPredicate: {
1731
3884
  <A, B extends A>(refinement: Refinement<A, B>): (a: A) => Array<B>;
3885
+ /**
3886
+ * Lifts a predicate into an array.
3887
+ *
3888
+ * @example
3889
+ * import { Array } from "effect"
3890
+ *
3891
+ * const isEven = (n: number) => n % 2 === 0
3892
+ * const to = Array.liftPredicate(isEven)
3893
+ * assert.deepStrictEqual(to(1), [])
3894
+ * assert.deepStrictEqual(to(2), [2])
3895
+ *
3896
+ * @category lifting
3897
+ * @since 2.0.0
3898
+ */
1732
3899
  <A>(predicate: Predicate<A>): <B extends A>(b: B) => Array<B>;
1733
3900
  };
1734
3901
  /**
@@ -1765,7 +3932,43 @@ export declare const liftNullable: <A extends Array<unknown>, B>(f: (...a: A) =>
1765
3932
  * @since 2.0.0
1766
3933
  */
1767
3934
  export declare const flatMapNullable: {
3935
+ /**
3936
+ * Maps over an array and flattens the result, removing null and undefined values.
3937
+ *
3938
+ * @example
3939
+ * import { Array } from "effect"
3940
+ *
3941
+ * const numbers = [1, 2, 3]
3942
+ * const result = Array.flatMapNullable(numbers, n => (n % 2 === 0 ? null : n))
3943
+ * assert.deepStrictEqual(result, [1, 3])
3944
+ *
3945
+ * // Explanation:
3946
+ * // The array of numbers [1, 2, 3] is mapped with a function that returns null for even numbers
3947
+ * // and the number itself for odd numbers. The resulting array [1, null, 3] is then flattened
3948
+ * // to remove null values, resulting in [1, 3].
3949
+ *
3950
+ * @category sequencing
3951
+ * @since 2.0.0
3952
+ */
1768
3953
  <A, B>(f: (a: A) => B | null | undefined): (self: ReadonlyArray<A>) => Array<NonNullable<B>>;
3954
+ /**
3955
+ * Maps over an array and flattens the result, removing null and undefined values.
3956
+ *
3957
+ * @example
3958
+ * import { Array } from "effect"
3959
+ *
3960
+ * const numbers = [1, 2, 3]
3961
+ * const result = Array.flatMapNullable(numbers, n => (n % 2 === 0 ? null : n))
3962
+ * assert.deepStrictEqual(result, [1, 3])
3963
+ *
3964
+ * // Explanation:
3965
+ * // The array of numbers [1, 2, 3] is mapped with a function that returns null for even numbers
3966
+ * // and the number itself for odd numbers. The resulting array [1, null, 3] is then flattened
3967
+ * // to remove null values, resulting in [1, 3].
3968
+ *
3969
+ * @category sequencing
3970
+ * @since 2.0.0
3971
+ */
1769
3972
  <A, B>(self: ReadonlyArray<A>, f: (a: A) => B | null | undefined): Array<NonNullable<B>>;
1770
3973
  };
1771
3974
  /**
@@ -1803,9 +4006,33 @@ export declare const liftEither: <A extends Array<unknown>, E, B>(f: (...a: A) =
1803
4006
  * @since 2.0.0
1804
4007
  */
1805
4008
  export declare const every: {
4009
+ /**
4010
+ * Check if a predicate holds true for every `ReadonlyArray` element.
4011
+ *
4012
+ * @category elements
4013
+ * @since 2.0.0
4014
+ */
1806
4015
  <A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: ReadonlyArray<A>) => self is ReadonlyArray<B>;
4016
+ /**
4017
+ * Check if a predicate holds true for every `ReadonlyArray` element.
4018
+ *
4019
+ * @category elements
4020
+ * @since 2.0.0
4021
+ */
1807
4022
  <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: ReadonlyArray<A>) => boolean;
4023
+ /**
4024
+ * Check if a predicate holds true for every `ReadonlyArray` element.
4025
+ *
4026
+ * @category elements
4027
+ * @since 2.0.0
4028
+ */
1808
4029
  <A, B extends A>(self: ReadonlyArray<A>, refinement: (a: A, i: number) => a is B): self is ReadonlyArray<B>;
4030
+ /**
4031
+ * Check if a predicate holds true for every `ReadonlyArray` element.
4032
+ *
4033
+ * @category elements
4034
+ * @since 2.0.0
4035
+ */
1809
4036
  <A>(self: ReadonlyArray<A>, predicate: (a: A, i: number) => boolean): boolean;
1810
4037
  };
1811
4038
  /**
@@ -1815,7 +4042,19 @@ export declare const every: {
1815
4042
  * @since 2.0.0
1816
4043
  */
1817
4044
  export declare const some: {
4045
+ /**
4046
+ * Check if a predicate holds true for some `ReadonlyArray` element.
4047
+ *
4048
+ * @category elements
4049
+ * @since 2.0.0
4050
+ */
1818
4051
  <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: ReadonlyArray<A>) => self is NonEmptyReadonlyArray<A>;
4052
+ /**
4053
+ * Check if a predicate holds true for some `ReadonlyArray` element.
4054
+ *
4055
+ * @category elements
4056
+ * @since 2.0.0
4057
+ */
1819
4058
  <A>(self: ReadonlyArray<A>, predicate: (a: A, i: number) => boolean): self is NonEmptyReadonlyArray<A>;
1820
4059
  };
1821
4060
  /**
@@ -1837,7 +4076,43 @@ export declare const some: {
1837
4076
  * @since 2.0.0
1838
4077
  */
1839
4078
  export declare const extend: {
4079
+ /**
4080
+ * Extends an array with a function that maps each subarray to a value.
4081
+ *
4082
+ * @example
4083
+ * import { Array } from "effect"
4084
+ *
4085
+ * const numbers = [1, 2, 3]
4086
+ * const result = Array.extend(numbers, as => as.length)
4087
+ * assert.deepStrictEqual(result, [3, 2, 1])
4088
+ *
4089
+ * // Explanation:
4090
+ * // The function maps each subarray starting from each element to its length.
4091
+ * // The subarrays are: [1, 2, 3], [2, 3], [3].
4092
+ * // The lengths are: 3, 2, 1.
4093
+ * // Therefore, the result is [3, 2, 1].
4094
+ *
4095
+ * @since 2.0.0
4096
+ */
1840
4097
  <A, B>(f: (as: ReadonlyArray<A>) => B): (self: ReadonlyArray<A>) => Array<B>;
4098
+ /**
4099
+ * Extends an array with a function that maps each subarray to a value.
4100
+ *
4101
+ * @example
4102
+ * import { Array } from "effect"
4103
+ *
4104
+ * const numbers = [1, 2, 3]
4105
+ * const result = Array.extend(numbers, as => as.length)
4106
+ * assert.deepStrictEqual(result, [3, 2, 1])
4107
+ *
4108
+ * // Explanation:
4109
+ * // The function maps each subarray starting from each element to its length.
4110
+ * // The subarrays are: [1, 2, 3], [2, 3], [3].
4111
+ * // The lengths are: 3, 2, 1.
4112
+ * // Therefore, the result is [3, 2, 1].
4113
+ *
4114
+ * @since 2.0.0
4115
+ */
1841
4116
  <A, B>(self: ReadonlyArray<A>, f: (as: ReadonlyArray<A>) => B): Array<B>;
1842
4117
  };
1843
4118
  /**
@@ -1852,7 +4127,29 @@ export declare const extend: {
1852
4127
  * @since 2.0.0
1853
4128
  */
1854
4129
  export declare const min: {
4130
+ /**
4131
+ * Finds the minimum element in an array based on a comparator.
4132
+ *
4133
+ * @example
4134
+ * import { Array, Order } from "effect"
4135
+ *
4136
+ * const min = Array.min([3, 1, 2], Order.number)
4137
+ * assert.deepStrictEqual(min, 1)
4138
+ *
4139
+ * @since 2.0.0
4140
+ */
1855
4141
  <A>(O: Order.Order<A>): (self: NonEmptyReadonlyArray<A>) => A;
4142
+ /**
4143
+ * Finds the minimum element in an array based on a comparator.
4144
+ *
4145
+ * @example
4146
+ * import { Array, Order } from "effect"
4147
+ *
4148
+ * const min = Array.min([3, 1, 2], Order.number)
4149
+ * assert.deepStrictEqual(min, 1)
4150
+ *
4151
+ * @since 2.0.0
4152
+ */
1856
4153
  <A>(self: NonEmptyReadonlyArray<A>, O: Order.Order<A>): A;
1857
4154
  };
1858
4155
  /**
@@ -1867,7 +4164,29 @@ export declare const min: {
1867
4164
  * @since 2.0.0
1868
4165
  */
1869
4166
  export declare const max: {
4167
+ /**
4168
+ * Finds the maximum element in an array based on a comparator.
4169
+ *
4170
+ * @example
4171
+ * import { Array, Order } from "effect"
4172
+ *
4173
+ * const max = Array.max([3, 1, 2], Order.number)
4174
+ * assert.deepStrictEqual(max, 3)
4175
+ *
4176
+ * @since 2.0.0
4177
+ */
1870
4178
  <A>(O: Order.Order<A>): (self: NonEmptyReadonlyArray<A>) => A;
4179
+ /**
4180
+ * Finds the maximum element in an array based on a comparator.
4181
+ *
4182
+ * @example
4183
+ * import { Array, Order } from "effect"
4184
+ *
4185
+ * const max = Array.max([3, 1, 2], Order.number)
4186
+ * assert.deepStrictEqual(max, 3)
4187
+ *
4188
+ * @since 2.0.0
4189
+ */
1871
4190
  <A>(self: NonEmptyReadonlyArray<A>, O: Order.Order<A>): A;
1872
4191
  };
1873
4192
  /**
@@ -1912,7 +4231,29 @@ export declare const getEquivalence: <A>(isEquivalent: Equivalence.Equivalence<A
1912
4231
  * @since 2.0.0
1913
4232
  */
1914
4233
  export declare const forEach: {
4234
+ /**
4235
+ * Performs a side-effect for each element of the `Iterable`.
4236
+ *
4237
+ * @example
4238
+ * import { Array } from "effect"
4239
+ *
4240
+ * const numbers = [1, 2, 3]
4241
+ * Array.forEach(numbers, n => console.log(n)) // 1, 2, 3
4242
+ *
4243
+ * @since 2.0.0
4244
+ */
1915
4245
  <A>(f: (a: A, i: number) => void): (self: Iterable<A>) => void;
4246
+ /**
4247
+ * Performs a side-effect for each element of the `Iterable`.
4248
+ *
4249
+ * @example
4250
+ * import { Array } from "effect"
4251
+ *
4252
+ * const numbers = [1, 2, 3]
4253
+ * Array.forEach(numbers, n => console.log(n)) // 1, 2, 3
4254
+ *
4255
+ * @since 2.0.0
4256
+ */
1916
4257
  <A>(self: Iterable<A>, f: (a: A, i: number) => void): void;
1917
4258
  };
1918
4259
  /**
@@ -1929,8 +4270,47 @@ export declare const forEach: {
1929
4270
  * @since 2.0.0
1930
4271
  */
1931
4272
  export declare const dedupeWith: {
4273
+ /**
4274
+ * Remove duplicates from an `Iterable` using the provided `isEquivalent` function,
4275
+ * preserving the order of the first occurrence of each element.
4276
+ *
4277
+ * @example
4278
+ * import { Array } from "effect"
4279
+ *
4280
+ * const numbers = [1, 2, 2, 3, 3, 3]
4281
+ * const unique = Array.dedupeWith(numbers, (a, b) => a === b)
4282
+ * assert.deepStrictEqual(unique, [1, 2, 3])
4283
+ *
4284
+ * @since 2.0.0
4285
+ */
1932
4286
  <S extends Iterable<any>>(isEquivalent: (self: ReadonlyArray.Infer<S>, that: ReadonlyArray.Infer<S>) => boolean): (self: S) => ReadonlyArray.With<S, ReadonlyArray.Infer<S>>;
4287
+ /**
4288
+ * Remove duplicates from an `Iterable` using the provided `isEquivalent` function,
4289
+ * preserving the order of the first occurrence of each element.
4290
+ *
4291
+ * @example
4292
+ * import { Array } from "effect"
4293
+ *
4294
+ * const numbers = [1, 2, 2, 3, 3, 3]
4295
+ * const unique = Array.dedupeWith(numbers, (a, b) => a === b)
4296
+ * assert.deepStrictEqual(unique, [1, 2, 3])
4297
+ *
4298
+ * @since 2.0.0
4299
+ */
1933
4300
  <A>(self: NonEmptyReadonlyArray<A>, isEquivalent: (self: A, that: A) => boolean): NonEmptyArray<A>;
4301
+ /**
4302
+ * Remove duplicates from an `Iterable` using the provided `isEquivalent` function,
4303
+ * preserving the order of the first occurrence of each element.
4304
+ *
4305
+ * @example
4306
+ * import { Array } from "effect"
4307
+ *
4308
+ * const numbers = [1, 2, 2, 3, 3, 3]
4309
+ * const unique = Array.dedupeWith(numbers, (a, b) => a === b)
4310
+ * assert.deepStrictEqual(unique, [1, 2, 3])
4311
+ *
4312
+ * @since 2.0.0
4313
+ */
1934
4314
  <A>(self: Iterable<A>, isEquivalent: (self: A, that: A) => boolean): Array<A>;
1935
4315
  };
1936
4316
  /**
@@ -1953,7 +4333,31 @@ export declare const dedupe: <S extends Iterable<any> | NonEmptyReadonlyArray<an
1953
4333
  * @since 2.0.0
1954
4334
  */
1955
4335
  export declare const dedupeAdjacentWith: {
4336
+ /**
4337
+ * Deduplicates adjacent elements that are identical using the provided `isEquivalent` function.
4338
+ *
4339
+ * @example
4340
+ * import { Array } from "effect"
4341
+ *
4342
+ * const numbers = [1, 1, 2, 2, 3, 3]
4343
+ * const unique = Array.dedupeAdjacentWith(numbers, (a, b) => a === b)
4344
+ * assert.deepStrictEqual(unique, [1, 2, 3])
4345
+ *
4346
+ * @since 2.0.0
4347
+ */
1956
4348
  <A>(isEquivalent: (self: A, that: A) => boolean): (self: Iterable<A>) => Array<A>;
4349
+ /**
4350
+ * Deduplicates adjacent elements that are identical using the provided `isEquivalent` function.
4351
+ *
4352
+ * @example
4353
+ * import { Array } from "effect"
4354
+ *
4355
+ * const numbers = [1, 1, 2, 2, 3, 3]
4356
+ * const unique = Array.dedupeAdjacentWith(numbers, (a, b) => a === b)
4357
+ * assert.deepStrictEqual(unique, [1, 2, 3])
4358
+ *
4359
+ * @since 2.0.0
4360
+ */
1957
4361
  <A>(self: Iterable<A>, isEquivalent: (self: A, that: A) => boolean): Array<A>;
1958
4362
  };
1959
4363
  /**
@@ -1983,7 +4387,33 @@ export declare const dedupeAdjacent: <A>(self: Iterable<A>) => Array<A>;
1983
4387
  * @category folding
1984
4388
  */
1985
4389
  export declare const join: {
4390
+ /**
4391
+ * Joins the elements together with "sep" in the middle.
4392
+ *
4393
+ * @example
4394
+ * import { Array } from "effect"
4395
+ *
4396
+ * const strings = ["a", "b", "c"]
4397
+ * const joined = Array.join(strings, "-")
4398
+ * assert.deepStrictEqual(joined, "a-b-c")
4399
+ *
4400
+ * @since 2.0.0
4401
+ * @category folding
4402
+ */
1986
4403
  (sep: string): (self: Iterable<string>) => string;
4404
+ /**
4405
+ * Joins the elements together with "sep" in the middle.
4406
+ *
4407
+ * @example
4408
+ * import { Array } from "effect"
4409
+ *
4410
+ * const strings = ["a", "b", "c"]
4411
+ * const joined = Array.join(strings, "-")
4412
+ * assert.deepStrictEqual(joined, "a-b-c")
4413
+ *
4414
+ * @since 2.0.0
4415
+ * @category folding
4416
+ */
1987
4417
  (self: Iterable<string>, sep: string): string;
1988
4418
  };
1989
4419
  /**
@@ -2000,7 +4430,33 @@ export declare const join: {
2000
4430
  * @category folding
2001
4431
  */
2002
4432
  export declare const mapAccum: {
4433
+ /**
4434
+ * Statefully maps over the chunk, producing new elements of type `B`.
4435
+ *
4436
+ * @example
4437
+ * import { Array } from "effect"
4438
+ *
4439
+ * const numbers = [1, 2, 3]
4440
+ * const result = Array.mapAccum(numbers, 0, (acc, n) => [acc + n, acc + n])
4441
+ * assert.deepStrictEqual(result, [6, [1, 3, 6]])
4442
+ *
4443
+ * @since 2.0.0
4444
+ * @category folding
4445
+ */
2003
4446
  <S, A, B>(s: S, f: (s: S, a: A, i: number) => readonly [S, B]): (self: Iterable<A>) => [state: S, mappedArray: Array<B>];
4447
+ /**
4448
+ * Statefully maps over the chunk, producing new elements of type `B`.
4449
+ *
4450
+ * @example
4451
+ * import { Array } from "effect"
4452
+ *
4453
+ * const numbers = [1, 2, 3]
4454
+ * const result = Array.mapAccum(numbers, 0, (acc, n) => [acc + n, acc + n])
4455
+ * assert.deepStrictEqual(result, [6, [1, 3, 6]])
4456
+ *
4457
+ * @since 2.0.0
4458
+ * @category folding
4459
+ */
2004
4460
  <S, A, B>(self: Iterable<A>, s: S, f: (s: S, a: A, i: number) => readonly [S, B]): [state: S, mappedArray: Array<B>];
2005
4461
  };
2006
4462
  /**
@@ -2018,7 +4474,35 @@ export declare const mapAccum: {
2018
4474
  * @category elements
2019
4475
  */
2020
4476
  export declare const cartesianWith: {
4477
+ /**
4478
+ * Zips this chunk crosswise with the specified chunk using the specified combiner.
4479
+ *
4480
+ * @example
4481
+ * import { Array } from "effect"
4482
+ *
4483
+ * const array1 = [1, 2]
4484
+ * const array2 = ["a", "b"]
4485
+ * const product = Array.cartesianWith(array1, array2, (a, b) => `${a}-${b}`)
4486
+ * assert.deepStrictEqual(product, ["1-a", "1-b", "2-a", "2-b"])
4487
+ *
4488
+ * @since 2.0.0
4489
+ * @category elements
4490
+ */
2021
4491
  <A, B, C>(that: ReadonlyArray<B>, f: (a: A, b: B) => C): (self: ReadonlyArray<A>) => Array<C>;
4492
+ /**
4493
+ * Zips this chunk crosswise with the specified chunk using the specified combiner.
4494
+ *
4495
+ * @example
4496
+ * import { Array } from "effect"
4497
+ *
4498
+ * const array1 = [1, 2]
4499
+ * const array2 = ["a", "b"]
4500
+ * const product = Array.cartesianWith(array1, array2, (a, b) => `${a}-${b}`)
4501
+ * assert.deepStrictEqual(product, ["1-a", "1-b", "2-a", "2-b"])
4502
+ *
4503
+ * @since 2.0.0
4504
+ * @category elements
4505
+ */
2022
4506
  <A, B, C>(self: ReadonlyArray<A>, that: ReadonlyArray<B>, f: (a: A, b: B) => C): Array<C>;
2023
4507
  };
2024
4508
  /**
@@ -2036,7 +4520,35 @@ export declare const cartesianWith: {
2036
4520
  * @category elements
2037
4521
  */
2038
4522
  export declare const cartesian: {
4523
+ /**
4524
+ * Zips this chunk crosswise with the specified chunk.
4525
+ *
4526
+ * @example
4527
+ * import { Array } from "effect"
4528
+ *
4529
+ * const array1 = [1, 2]
4530
+ * const array2 = ["a", "b"]
4531
+ * const product = Array.cartesian(array1, array2)
4532
+ * assert.deepStrictEqual(product, [[1, "a"], [1, "b"], [2, "a"], [2, "b"]])
4533
+ *
4534
+ * @since 2.0.0
4535
+ * @category elements
4536
+ */
2039
4537
  <B>(that: ReadonlyArray<B>): <A>(self: ReadonlyArray<A>) => Array<[A, B]>;
4538
+ /**
4539
+ * Zips this chunk crosswise with the specified chunk.
4540
+ *
4541
+ * @example
4542
+ * import { Array } from "effect"
4543
+ *
4544
+ * const array1 = [1, 2]
4545
+ * const array2 = ["a", "b"]
4546
+ * const product = Array.cartesian(array1, array2)
4547
+ * assert.deepStrictEqual(product, [[1, "a"], [1, "b"], [2, "a"], [2, "b"]])
4548
+ *
4549
+ * @since 2.0.0
4550
+ * @category elements
4551
+ */
2040
4552
  <A, B>(self: ReadonlyArray<A>, that: ReadonlyArray<B>): Array<[A, B]>;
2041
4553
  };
2042
4554
  /**
@@ -2127,9 +4639,95 @@ export declare const Do: ReadonlyArray<{}>;
2127
4639
  * @since 3.2.0
2128
4640
  */
2129
4641
  export declare const bind: {
4642
+ /**
4643
+ * 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.
4644
+ *
4645
+ * It can be used to simulate "array comprehension".
4646
+ * It's a technique that allows you to create new arrays by iterating over existing ones and applying specific **conditions** or **transformations** to the elements. It's like assembling a new collection from pieces of other collections based on certain rules.
4647
+ *
4648
+ * Here's how the do simulation works:
4649
+ *
4650
+ * 1. Start the do simulation using the `Do` value
4651
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Array` values
4652
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
4653
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
4654
+ * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
4655
+ *
4656
+ * @see {@link bindTo}
4657
+ * @see {@link Do}
4658
+ * @see {@link let_ let}
4659
+ *
4660
+ * @example
4661
+ * import { Array as Arr, pipe } from "effect"
4662
+ * const doResult = pipe(
4663
+ * Arr.Do,
4664
+ * Arr.bind("x", () => [1, 3, 5]),
4665
+ * Arr.bind("y", () => [2, 4, 6]),
4666
+ * Arr.filter(({ x, y }) => x < y), // condition
4667
+ * Arr.map(({ x, y }) => [x, y] as const) // transformation
4668
+ * )
4669
+ * assert.deepStrictEqual(doResult, [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]])
4670
+ *
4671
+ * // equivalent
4672
+ * const x = [1, 3, 5],
4673
+ * y = [2, 4, 6],
4674
+ * result = [];
4675
+ * for(let i = 0; i < x.length; i++) {
4676
+ * for(let j = 0; j < y.length; j++) {
4677
+ * const _x = x[i], _y = y[j];
4678
+ * if(_x < _y) result.push([_x, _y] as const)
4679
+ * }
4680
+ * }
4681
+ *
4682
+ * @category do notation
4683
+ * @since 3.2.0
4684
+ */
2130
4685
  <A extends object, N extends string, B>(tag: Exclude<N, keyof A>, f: (a: A) => ReadonlyArray<B>): (self: ReadonlyArray<A>) => Array<{
2131
4686
  [K in N | keyof A]: K extends keyof A ? A[K] : B;
2132
4687
  }>;
4688
+ /**
4689
+ * 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.
4690
+ *
4691
+ * It can be used to simulate "array comprehension".
4692
+ * It's a technique that allows you to create new arrays by iterating over existing ones and applying specific **conditions** or **transformations** to the elements. It's like assembling a new collection from pieces of other collections based on certain rules.
4693
+ *
4694
+ * Here's how the do simulation works:
4695
+ *
4696
+ * 1. Start the do simulation using the `Do` value
4697
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Array` values
4698
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
4699
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
4700
+ * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
4701
+ *
4702
+ * @see {@link bindTo}
4703
+ * @see {@link Do}
4704
+ * @see {@link let_ let}
4705
+ *
4706
+ * @example
4707
+ * import { Array as Arr, pipe } from "effect"
4708
+ * const doResult = pipe(
4709
+ * Arr.Do,
4710
+ * Arr.bind("x", () => [1, 3, 5]),
4711
+ * Arr.bind("y", () => [2, 4, 6]),
4712
+ * Arr.filter(({ x, y }) => x < y), // condition
4713
+ * Arr.map(({ x, y }) => [x, y] as const) // transformation
4714
+ * )
4715
+ * assert.deepStrictEqual(doResult, [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]])
4716
+ *
4717
+ * // equivalent
4718
+ * const x = [1, 3, 5],
4719
+ * y = [2, 4, 6],
4720
+ * result = [];
4721
+ * for(let i = 0; i < x.length; i++) {
4722
+ * for(let j = 0; j < y.length; j++) {
4723
+ * const _x = x[i], _y = y[j];
4724
+ * if(_x < _y) result.push([_x, _y] as const)
4725
+ * }
4726
+ * }
4727
+ *
4728
+ * @category do notation
4729
+ * @since 3.2.0
4730
+ */
2133
4731
  <A extends object, N extends string, B>(self: ReadonlyArray<A>, tag: Exclude<N, keyof A>, f: (a: A) => ReadonlyArray<B>): Array<{
2134
4732
  [K in N | keyof A]: K extends keyof A ? A[K] : B;
2135
4733
  }>;
@@ -2178,9 +4776,95 @@ export declare const bind: {
2178
4776
  * @since 3.2.0
2179
4777
  */
2180
4778
  export declare const bindTo: {
4779
+ /**
4780
+ * 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.
4781
+ *
4782
+ * It can be used to simulate "array comprehension".
4783
+ * It's a technique that allows you to create new arrays by iterating over existing ones and applying specific **conditions** or **transformations** to the elements. It's like assembling a new collection from pieces of other collections based on certain rules.
4784
+ *
4785
+ * Here's how the do simulation works:
4786
+ *
4787
+ * 1. Start the do simulation using the `Do` value
4788
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Array` values
4789
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
4790
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
4791
+ * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
4792
+ *
4793
+ * @see {@link bindTo}
4794
+ * @see {@link Do}
4795
+ * @see {@link let_ let}
4796
+ *
4797
+ * @example
4798
+ * import { Array as Arr, pipe } from "effect"
4799
+ * const doResult = pipe(
4800
+ * Arr.Do,
4801
+ * Arr.bind("x", () => [1, 3, 5]),
4802
+ * Arr.bind("y", () => [2, 4, 6]),
4803
+ * Arr.filter(({ x, y }) => x < y), // condition
4804
+ * Arr.map(({ x, y }) => [x, y] as const) // transformation
4805
+ * )
4806
+ * assert.deepStrictEqual(doResult, [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]])
4807
+ *
4808
+ * // equivalent
4809
+ * const x = [1, 3, 5],
4810
+ * y = [2, 4, 6],
4811
+ * result = [];
4812
+ * for(let i = 0; i < x.length; i++) {
4813
+ * for(let j = 0; j < y.length; j++) {
4814
+ * const _x = x[i], _y = y[j];
4815
+ * if(_x < _y) result.push([_x, _y] as const)
4816
+ * }
4817
+ * }
4818
+ *
4819
+ * @category do notation
4820
+ * @since 3.2.0
4821
+ */
2181
4822
  <N extends string>(tag: N): <A>(self: ReadonlyArray<A>) => Array<{
2182
4823
  [K in N]: A;
2183
4824
  }>;
4825
+ /**
4826
+ * 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.
4827
+ *
4828
+ * It can be used to simulate "array comprehension".
4829
+ * It's a technique that allows you to create new arrays by iterating over existing ones and applying specific **conditions** or **transformations** to the elements. It's like assembling a new collection from pieces of other collections based on certain rules.
4830
+ *
4831
+ * Here's how the do simulation works:
4832
+ *
4833
+ * 1. Start the do simulation using the `Do` value
4834
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Array` values
4835
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
4836
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
4837
+ * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
4838
+ *
4839
+ * @see {@link bindTo}
4840
+ * @see {@link Do}
4841
+ * @see {@link let_ let}
4842
+ *
4843
+ * @example
4844
+ * import { Array as Arr, pipe } from "effect"
4845
+ * const doResult = pipe(
4846
+ * Arr.Do,
4847
+ * Arr.bind("x", () => [1, 3, 5]),
4848
+ * Arr.bind("y", () => [2, 4, 6]),
4849
+ * Arr.filter(({ x, y }) => x < y), // condition
4850
+ * Arr.map(({ x, y }) => [x, y] as const) // transformation
4851
+ * )
4852
+ * assert.deepStrictEqual(doResult, [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]])
4853
+ *
4854
+ * // equivalent
4855
+ * const x = [1, 3, 5],
4856
+ * y = [2, 4, 6],
4857
+ * result = [];
4858
+ * for(let i = 0; i < x.length; i++) {
4859
+ * for(let j = 0; j < y.length; j++) {
4860
+ * const _x = x[i], _y = y[j];
4861
+ * if(_x < _y) result.push([_x, _y] as const)
4862
+ * }
4863
+ * }
4864
+ *
4865
+ * @category do notation
4866
+ * @since 3.2.0
4867
+ */
2184
4868
  <A, N extends string>(self: ReadonlyArray<A>, tag: N): Array<{
2185
4869
  [K in N]: A;
2186
4870
  }>;