@fncts/base 0.0.20 → 0.0.21

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 (975) hide show
  1. package/_cjs/collection/Iterable/api/traverseConc.cjs +8 -8
  2. package/_cjs/collection/Iterable/api/traverseConc.cjs.map +1 -1
  3. package/_cjs/collection/Iterable/api.cjs +497 -444
  4. package/_cjs/collection/Iterable/api.cjs.map +1 -1
  5. package/_cjs/collection/Iterable/constructors.cjs +7 -7
  6. package/_cjs/collection/Iterable/constructors.cjs.map +1 -1
  7. package/_cjs/collection/compat/Array/api.cjs +16 -12
  8. package/_cjs/collection/compat/Array/api.cjs.map +1 -1
  9. package/_cjs/collection/compat/Array/derivations.cjs +41 -19
  10. package/_cjs/collection/compat/Array/derivations.cjs.map +1 -1
  11. package/_cjs/collection/compat/ArrayLike/api.cjs +1 -1
  12. package/_cjs/collection/compat/ArrayLike/api.cjs.map +1 -1
  13. package/_cjs/collection/compat/Record/instances.cjs +39 -3
  14. package/_cjs/collection/compat/Record/instances.cjs.map +1 -1
  15. package/_cjs/collection/immutable/Conc/api/makeBy.cjs +1 -1
  16. package/_cjs/collection/immutable/Conc/api/makeBy.cjs.map +1 -1
  17. package/_cjs/collection/immutable/Conc/api.cjs +866 -765
  18. package/_cjs/collection/immutable/Conc/api.cjs.map +1 -1
  19. package/_cjs/collection/immutable/Conc/definition.cjs +55 -53
  20. package/_cjs/collection/immutable/Conc/definition.cjs.map +1 -1
  21. package/_cjs/collection/immutable/Conc/derivations.cjs +13 -2
  22. package/_cjs/collection/immutable/Conc/derivations.cjs.map +1 -1
  23. package/_cjs/collection/immutable/Conc.cjs.map +1 -1
  24. package/_cjs/collection/immutable/Dictionary/api.cjs +57 -44
  25. package/_cjs/collection/immutable/Dictionary/api.cjs.map +1 -1
  26. package/_cjs/collection/immutable/HashMap/api.cjs +351 -258
  27. package/_cjs/collection/immutable/HashMap/api.cjs.map +1 -1
  28. package/_cjs/collection/immutable/HashMap/definition.cjs +1 -1
  29. package/_cjs/collection/immutable/HashMap/definition.cjs.map +1 -1
  30. package/_cjs/collection/immutable/HashMap/internal.cjs.map +1 -1
  31. package/_cjs/collection/immutable/HashSet/api.cjs +230 -192
  32. package/_cjs/collection/immutable/HashSet/api.cjs.map +1 -1
  33. package/_cjs/collection/immutable/HashSet/definition.cjs +1 -1
  34. package/_cjs/collection/immutable/HashSet/definition.cjs.map +1 -1
  35. package/_cjs/collection/immutable/ImmutableArray/api/chunksOf.cjs +6 -4
  36. package/_cjs/collection/immutable/ImmutableArray/api/chunksOf.cjs.map +1 -1
  37. package/_cjs/collection/immutable/ImmutableArray/api/slice.cjs +6 -4
  38. package/_cjs/collection/immutable/ImmutableArray/api/slice.cjs.map +1 -1
  39. package/_cjs/collection/immutable/ImmutableArray/api/splitAt.cjs +6 -4
  40. package/_cjs/collection/immutable/ImmutableArray/api/splitAt.cjs.map +1 -1
  41. package/_cjs/collection/immutable/ImmutableArray/api/splitWhere.cjs +15 -13
  42. package/_cjs/collection/immutable/ImmutableArray/api/splitWhere.cjs.map +1 -1
  43. package/_cjs/collection/immutable/ImmutableArray/api.cjs +943 -749
  44. package/_cjs/collection/immutable/ImmutableArray/api.cjs.map +1 -1
  45. package/_cjs/collection/immutable/ImmutableArray/derivations.cjs +12 -1
  46. package/_cjs/collection/immutable/ImmutableArray/derivations.cjs.map +1 -1
  47. package/_cjs/collection/immutable/ImmutableArray/instances.cjs +33 -33
  48. package/_cjs/collection/immutable/ImmutableArray/instances.cjs.map +1 -1
  49. package/_cjs/collection/immutable/ImmutableArray.cjs.map +1 -1
  50. package/_cjs/collection/immutable/ImmutableNonEmptyArray/api.cjs +338 -273
  51. package/_cjs/collection/immutable/ImmutableNonEmptyArray/api.cjs.map +1 -1
  52. package/_cjs/collection/immutable/ImmutableNonEmptyArray/constructors.cjs.map +1 -1
  53. package/_cjs/collection/immutable/ImmutableNonEmptyArray/definition.cjs.map +1 -1
  54. package/_cjs/collection/immutable/ImmutableNonEmptyArray/derivations.cjs +15 -4
  55. package/_cjs/collection/immutable/ImmutableNonEmptyArray/derivations.cjs.map +1 -1
  56. package/_cjs/collection/immutable/ImmutableNonEmptyArray/destructors.cjs +2 -2
  57. package/_cjs/collection/immutable/ImmutableNonEmptyArray/destructors.cjs.map +1 -1
  58. package/_cjs/collection/immutable/ImmutableNonEmptyArray/instances.cjs +12 -12
  59. package/_cjs/collection/immutable/ImmutableNonEmptyArray/instances.cjs.map +1 -1
  60. package/_cjs/collection/immutable/List/api/foldLeft.cjs +12 -10
  61. package/_cjs/collection/immutable/List/api/foldLeft.cjs.map +1 -1
  62. package/_cjs/collection/immutable/List/api.cjs +164 -141
  63. package/_cjs/collection/immutable/List/api.cjs.map +1 -1
  64. package/_cjs/collection/immutable/List.cjs.map +1 -1
  65. package/_cjs/collection/immutable/Queue/api.cjs +64 -48
  66. package/_cjs/collection/immutable/Queue/api.cjs.map +1 -1
  67. package/_cjs/collection/immutable/Queue/definition.cjs +1 -1
  68. package/_cjs/collection/immutable/Queue/definition.cjs.map +1 -1
  69. package/_cjs/collection/immutable/RoseTree/api.cjs +50 -36
  70. package/_cjs/collection/immutable/RoseTree/api.cjs.map +1 -1
  71. package/_cjs/collection/immutable/RoseTree/definition.cjs.map +1 -1
  72. package/_cjs/collection/immutable/SortedMap/api.cjs +408 -368
  73. package/_cjs/collection/immutable/SortedMap/api.cjs.map +1 -1
  74. package/_cjs/collection/immutable/Vector/api.cjs +723 -608
  75. package/_cjs/collection/immutable/Vector/api.cjs.map +1 -1
  76. package/_cjs/collection/immutable/Vector/definition.cjs +18 -16
  77. package/_cjs/collection/immutable/Vector/definition.cjs.map +1 -1
  78. package/_cjs/collection/immutable/Vector/internal.cjs +40 -39
  79. package/_cjs/collection/immutable/Vector/internal.cjs.map +1 -1
  80. package/_cjs/collection/mutable/HashMap.cjs +3 -5
  81. package/_cjs/collection/mutable/HashMap.cjs.map +1 -1
  82. package/_cjs/collection/mutable/HashSet.cjs.map +1 -1
  83. package/_cjs/collection/mutable/ListBuffer.cjs +2 -2
  84. package/_cjs/collection/mutable/ListBuffer.cjs.map +1 -1
  85. package/_cjs/collection/mutable/internal.cjs +0 -2
  86. package/_cjs/collection/mutable/internal.cjs.map +1 -1
  87. package/_cjs/collection/weak/IterableWeakMap.cjs +7 -7
  88. package/_cjs/collection/weak/IterableWeakMap.cjs.map +1 -1
  89. package/_cjs/collection/weak/IterableWeakSet.cjs +7 -7
  90. package/_cjs/collection/weak/IterableWeakSet.cjs.map +1 -1
  91. package/_cjs/control/Eval/api.cjs +55 -43
  92. package/_cjs/control/Eval/api.cjs.map +1 -1
  93. package/_cjs/control/Eval/instance.cjs +4 -4
  94. package/_cjs/control/Eval/instance.cjs.map +1 -1
  95. package/_cjs/control/Eval/run.cjs +1 -1
  96. package/_cjs/control/Eval/run.cjs.map +1 -1
  97. package/_cjs/control/Z/api.cjs +241 -172
  98. package/_cjs/control/Z/api.cjs.map +1 -1
  99. package/_cjs/control/Z/instances.cjs +3 -3
  100. package/_cjs/control/Z/instances.cjs.map +1 -1
  101. package/_cjs/control/Z/runtime.cjs +250 -241
  102. package/_cjs/control/Z/runtime.cjs.map +1 -1
  103. package/_cjs/data/Branded/definition.cjs.map +1 -1
  104. package/_cjs/data/Branded/derivations.cjs +3 -3
  105. package/_cjs/data/Branded/derivations.cjs.map +1 -1
  106. package/_cjs/data/CaseClass.cjs.map +1 -1
  107. package/_cjs/data/Cause/api/fold.cjs +20 -18
  108. package/_cjs/data/Cause/api/fold.cjs.map +1 -1
  109. package/_cjs/data/Cause/api/isEmpty.cjs +1 -1
  110. package/_cjs/data/Cause/api/isEmpty.cjs.map +1 -1
  111. package/_cjs/data/Cause/api/linearize.cjs +8 -8
  112. package/_cjs/data/Cause/api/linearize.cjs.map +1 -1
  113. package/_cjs/data/Cause/api/prettyPrint.cjs +1 -1
  114. package/_cjs/data/Cause/api/prettyPrint.cjs.map +1 -1
  115. package/_cjs/data/Cause/api.cjs +160 -140
  116. package/_cjs/data/Cause/api.cjs.map +1 -1
  117. package/_cjs/data/Cause/definition.cjs +18 -18
  118. package/_cjs/data/Cause/definition.cjs.map +1 -1
  119. package/_cjs/data/Cause.cjs.map +1 -1
  120. package/_cjs/data/Const/api.cjs +8 -6
  121. package/_cjs/data/Const/api.cjs.map +1 -1
  122. package/_cjs/data/Const/instances.cjs +4 -4
  123. package/_cjs/data/Const/instances.cjs.map +1 -1
  124. package/_cjs/data/Datum/api.cjs +219 -176
  125. package/_cjs/data/Datum/api.cjs.map +1 -1
  126. package/_cjs/data/Datum/definition.cjs.map +1 -1
  127. package/_cjs/data/DatumEither/api.cjs +165 -133
  128. package/_cjs/data/DatumEither/api.cjs.map +1 -1
  129. package/_cjs/data/DecodeError/definition.cjs +14 -14
  130. package/_cjs/data/DecodeError/definition.cjs.map +1 -1
  131. package/_cjs/data/Decoder/api.cjs +9 -7
  132. package/_cjs/data/Decoder/api.cjs.map +1 -1
  133. package/_cjs/data/Duration/api.cjs +18 -12
  134. package/_cjs/data/Duration/api.cjs.map +1 -1
  135. package/_cjs/data/Either/api/align.cjs +8 -3
  136. package/_cjs/data/Either/api/align.cjs.map +1 -1
  137. package/_cjs/data/Either/api/alignWith.cjs +14 -12
  138. package/_cjs/data/Either/api/alignWith.cjs.map +1 -1
  139. package/_cjs/data/Either/api.cjs +206 -169
  140. package/_cjs/data/Either/api.cjs.map +1 -1
  141. package/_cjs/data/Either/constructors.cjs +11 -9
  142. package/_cjs/data/Either/constructors.cjs.map +1 -1
  143. package/_cjs/data/Either/destructors.cjs +16 -14
  144. package/_cjs/data/Either/destructors.cjs.map +1 -1
  145. package/_cjs/data/Either/instances.cjs +8 -8
  146. package/_cjs/data/Either/instances.cjs.map +1 -1
  147. package/_cjs/data/EitherT/api.cjs +8 -8
  148. package/_cjs/data/EitherT/api.cjs.map +1 -1
  149. package/_cjs/data/Encoder/api.cjs +134 -0
  150. package/_cjs/data/Encoder/api.cjs.map +1 -0
  151. package/_cjs/data/Encoder/definition.cjs +25 -0
  152. package/_cjs/data/Encoder/definition.cjs.map +1 -0
  153. package/_cjs/data/Encoder.cjs +32 -0
  154. package/_cjs/data/Encoder.cjs.map +1 -0
  155. package/_cjs/data/Environment/api.cjs +45 -33
  156. package/_cjs/data/Environment/api.cjs.map +1 -1
  157. package/_cjs/data/EnvironmentPatch.cjs +17 -13
  158. package/_cjs/data/EnvironmentPatch.cjs.map +1 -1
  159. package/_cjs/data/ExecutionStrategy.cjs +21 -29
  160. package/_cjs/data/ExecutionStrategy.cjs.map +1 -1
  161. package/_cjs/data/Exit/api.cjs +159 -127
  162. package/_cjs/data/Exit/api.cjs.map +1 -1
  163. package/_cjs/data/Exit/constructors.cjs +4 -4
  164. package/_cjs/data/Exit/constructors.cjs.map +1 -1
  165. package/_cjs/data/FiberId/api.cjs +23 -21
  166. package/_cjs/data/FiberId/api.cjs.map +1 -1
  167. package/_cjs/data/FiberId/constructors.cjs.map +1 -1
  168. package/_cjs/data/Identity/api.cjs +26 -18
  169. package/_cjs/data/Identity/api.cjs.map +1 -1
  170. package/_cjs/data/Identity/instances.cjs +3 -3
  171. package/_cjs/data/Identity/instances.cjs.map +1 -1
  172. package/_cjs/data/Interval.cjs +43 -33
  173. package/_cjs/data/Interval.cjs.map +1 -1
  174. package/_cjs/data/Intervals.cjs +35 -27
  175. package/_cjs/data/Intervals.cjs.map +1 -1
  176. package/_cjs/data/Maybe/api.cjs +160 -125
  177. package/_cjs/data/Maybe/api.cjs.map +1 -1
  178. package/_cjs/data/Maybe/constructors.cjs +2 -2
  179. package/_cjs/data/Maybe/constructors.cjs.map +1 -1
  180. package/_cjs/data/Maybe/definition.cjs.map +1 -1
  181. package/_cjs/data/Maybe/destructors.cjs +9 -7
  182. package/_cjs/data/Maybe/destructors.cjs.map +1 -1
  183. package/_cjs/data/Maybe/instances.cjs +11 -11
  184. package/_cjs/data/Maybe/instances.cjs.map +1 -1
  185. package/_cjs/data/Predicate/api.cjs +10 -8
  186. package/_cjs/data/Predicate/api.cjs.map +1 -1
  187. package/_cjs/data/Refinement/api.cjs +15 -9
  188. package/_cjs/data/Refinement/api.cjs.map +1 -1
  189. package/_cjs/data/Struct/api.cjs +62 -50
  190. package/_cjs/data/Struct/api.cjs.map +1 -1
  191. package/_cjs/data/Tag/constructors.cjs +3 -2
  192. package/_cjs/data/Tag/constructors.cjs.map +1 -1
  193. package/_cjs/data/Tag/definition.cjs +0 -3
  194. package/_cjs/data/Tag/definition.cjs.map +1 -1
  195. package/_cjs/data/These/api.cjs +188 -170
  196. package/_cjs/data/These/api.cjs.map +1 -1
  197. package/_cjs/data/These/constructors.cjs +1 -1
  198. package/_cjs/data/These/constructors.cjs.map +1 -1
  199. package/_cjs/data/These/destructors.cjs +39 -35
  200. package/_cjs/data/These/destructors.cjs.map +1 -1
  201. package/_cjs/data/These/instances.cjs +1 -1
  202. package/_cjs/data/These/instances.cjs.map +1 -1
  203. package/_cjs/data/Trace/api.cjs +7 -5
  204. package/_cjs/data/Trace/api.cjs.map +1 -1
  205. package/_cjs/data/Zipped.cjs.map +1 -1
  206. package/_cjs/data/function/api.cjs +6 -4
  207. package/_cjs/data/function/api.cjs.map +1 -1
  208. package/_cjs/data/function/pipe.cjs +9 -0
  209. package/_cjs/data/function/pipe.cjs.map +1 -1
  210. package/_cjs/data/string/api.cjs +53 -96
  211. package/_cjs/data/string/api.cjs.map +1 -1
  212. package/_cjs/global/api.cjs +4 -2
  213. package/_cjs/global/api.cjs.map +1 -1
  214. package/_cjs/internal/AtomicBoolean.cjs.map +1 -1
  215. package/_cjs/internal/AtomicNumber.cjs.map +1 -1
  216. package/_cjs/internal/AtomicReference.cjs.map +1 -1
  217. package/_cjs/internal/Stack.cjs +2 -2
  218. package/_cjs/internal/Stack.cjs.map +1 -1
  219. package/_cjs/optics/At/api.cjs +1 -1
  220. package/_cjs/optics/At/api.cjs.map +1 -1
  221. package/_cjs/optics/At/definition.cjs +2 -2
  222. package/_cjs/optics/At/definition.cjs.map +1 -1
  223. package/_cjs/optics/Fold/definition.cjs +3 -4
  224. package/_cjs/optics/Fold/definition.cjs.map +1 -1
  225. package/_cjs/optics/Getter/definition.cjs +2 -3
  226. package/_cjs/optics/Getter/definition.cjs.map +1 -1
  227. package/_cjs/optics/Index/api.cjs +4 -4
  228. package/_cjs/optics/Index/api.cjs.map +1 -1
  229. package/_cjs/optics/Index/definition.cjs +2 -2
  230. package/_cjs/optics/Index/definition.cjs.map +1 -1
  231. package/_cjs/optics/Iso/api.cjs +9 -7
  232. package/_cjs/optics/Iso/api.cjs.map +1 -1
  233. package/_cjs/optics/Iso/definition.cjs +12 -12
  234. package/_cjs/optics/Iso/definition.cjs.map +1 -1
  235. package/_cjs/optics/Lens/api.cjs +54 -44
  236. package/_cjs/optics/Lens/api.cjs.map +1 -1
  237. package/_cjs/optics/Lens/definition.cjs +10 -10
  238. package/_cjs/optics/Lens/definition.cjs.map +1 -1
  239. package/_cjs/optics/Optional/api/compose.cjs +9 -7
  240. package/_cjs/optics/Optional/api/compose.cjs.map +1 -1
  241. package/_cjs/optics/Optional/definition.cjs +12 -13
  242. package/_cjs/optics/Optional/definition.cjs.map +1 -1
  243. package/_cjs/optics/Optional.cjs.map +1 -1
  244. package/_cjs/optics/Prism/api/compose.cjs +9 -7
  245. package/_cjs/optics/Prism/api/compose.cjs.map +1 -1
  246. package/_cjs/optics/Prism/api/fromNullable.cjs +2 -2
  247. package/_cjs/optics/Prism/api/fromNullable.cjs.map +1 -1
  248. package/_cjs/optics/Prism/api/just.cjs +2 -2
  249. package/_cjs/optics/Prism/api/just.cjs.map +1 -1
  250. package/_cjs/optics/Prism/definition.cjs +9 -9
  251. package/_cjs/optics/Prism/definition.cjs.map +1 -1
  252. package/_cjs/optics/Prism.cjs.map +1 -1
  253. package/_cjs/optics/Setter/definition.cjs +8 -13
  254. package/_cjs/optics/Setter/definition.cjs.map +1 -1
  255. package/_cjs/optics/Traversal/api/compose.cjs +8 -6
  256. package/_cjs/optics/Traversal/api/compose.cjs.map +1 -1
  257. package/_cjs/optics/Traversal/api/fromTraversable.cjs +2 -2
  258. package/_cjs/optics/Traversal/api/fromTraversable.cjs.map +1 -1
  259. package/_cjs/optics/Traversal/definition.cjs +12 -12
  260. package/_cjs/optics/Traversal/definition.cjs.map +1 -1
  261. package/_cjs/optics/Traversal.cjs.map +1 -1
  262. package/_cjs/typeclass/Align.cjs.map +1 -1
  263. package/_cjs/typeclass/Alt.cjs.map +1 -1
  264. package/_cjs/typeclass/Applicative.cjs.map +1 -1
  265. package/_cjs/typeclass/ApplicativeExcept.cjs +5 -10
  266. package/_cjs/typeclass/ApplicativeExcept.cjs.map +1 -1
  267. package/_cjs/typeclass/Apply.cjs +8 -8
  268. package/_cjs/typeclass/Apply.cjs.map +1 -1
  269. package/_cjs/typeclass/Chain.cjs +4 -4
  270. package/_cjs/typeclass/Chain.cjs.map +1 -1
  271. package/_cjs/typeclass/Eq/definition.cjs.map +1 -1
  272. package/_cjs/typeclass/Eq/derivations.cjs.map +1 -1
  273. package/_cjs/typeclass/Equatable/api.cjs.map +1 -1
  274. package/_cjs/typeclass/Equatable/definition.cjs.map +1 -1
  275. package/_cjs/typeclass/Equatable/fast-equals.cjs.map +1 -1
  276. package/_cjs/typeclass/Filterable.cjs.map +1 -1
  277. package/_cjs/typeclass/FilterableWithIndex.cjs.map +1 -1
  278. package/_cjs/typeclass/Foldable.cjs +1 -1
  279. package/_cjs/typeclass/Foldable.cjs.map +1 -1
  280. package/_cjs/typeclass/FoldableWithIndex.cjs +1 -1
  281. package/_cjs/typeclass/FoldableWithIndex.cjs.map +1 -1
  282. package/_cjs/typeclass/Functor.cjs.map +1 -1
  283. package/_cjs/typeclass/FunctorWithIndex.cjs.map +1 -1
  284. package/_cjs/typeclass/Guard/api.cjs +18 -10
  285. package/_cjs/typeclass/Guard/api.cjs.map +1 -1
  286. package/_cjs/typeclass/Guard/definition.cjs.map +1 -1
  287. package/_cjs/typeclass/Guard/derivations.cjs.map +1 -1
  288. package/_cjs/typeclass/Has.cjs +7 -5
  289. package/_cjs/typeclass/Has.cjs.map +1 -1
  290. package/_cjs/typeclass/HashEq.cjs.map +1 -1
  291. package/_cjs/typeclass/Hashable/definition.cjs.map +1 -1
  292. package/_cjs/typeclass/Hashable/hash.cjs.map +1 -1
  293. package/_cjs/typeclass/MonadExcept.cjs +1 -1
  294. package/_cjs/typeclass/MonadExcept.cjs.map +1 -1
  295. package/_cjs/typeclass/Ord/api/contramap.cjs +7 -5
  296. package/_cjs/typeclass/Ord/api/contramap.cjs.map +1 -1
  297. package/_cjs/typeclass/Ord/api/max.cjs.map +1 -1
  298. package/_cjs/typeclass/Ord/api/min.cjs.map +1 -1
  299. package/_cjs/typeclass/Ord/definition.cjs.map +1 -1
  300. package/_cjs/typeclass/Ord/instances.cjs.map +1 -1
  301. package/_cjs/typeclass/Ordering.cjs.map +1 -1
  302. package/_cjs/typeclass/Semialign.cjs +7 -7
  303. package/_cjs/typeclass/Semialign.cjs.map +1 -1
  304. package/_cjs/typeclass/Semigroup/api.cjs.map +1 -1
  305. package/_cjs/typeclass/Semigroup/definition.cjs.map +1 -1
  306. package/_cjs/typeclass/Semigroup/derivations.cjs.map +1 -1
  307. package/_cjs/typeclass/Semimonoidal.cjs.map +1 -1
  308. package/_cjs/typeclass/Showable/definition.cjs.map +1 -1
  309. package/_cjs/typeclass/Showable/show.cjs +107 -107
  310. package/_cjs/typeclass/Showable/show.cjs.map +1 -1
  311. package/_cjs/typeclass/Showable/styles.cjs.map +1 -1
  312. package/_cjs/typeclass/Showable/util.cjs +1 -1
  313. package/_cjs/typeclass/Showable/util.cjs.map +1 -1
  314. package/_cjs/typeclass/Traversable.cjs +1 -2
  315. package/_cjs/typeclass/Traversable.cjs.map +1 -1
  316. package/_cjs/typeclass/TraversableWithIndex.cjs.map +1 -1
  317. package/_cjs/typeclass/Witherable.cjs +3 -1
  318. package/_cjs/typeclass/Witherable.cjs.map +1 -1
  319. package/_cjs/typeclass/WitherableWithIndex.cjs +3 -1
  320. package/_cjs/typeclass/WitherableWithIndex.cjs.map +1 -1
  321. package/_cjs/util/AnsiFormat.cjs +11 -11
  322. package/_cjs/util/AnsiFormat.cjs.map +1 -1
  323. package/_cjs/util/PCGRandom.cjs.map +1 -1
  324. package/_cjs/util/assert.cjs.map +1 -1
  325. package/_cjs/util/pattern.cjs.map +1 -1
  326. package/_cjs/util/predicates.cjs.map +1 -1
  327. package/_cjs/util/rand/Random.cjs.map +1 -1
  328. package/_cjs/util/rand/distribution/UniformArrayIntDistribution.cjs.map +1 -1
  329. package/_cjs/util/rand/distribution/UniformBigIntDistribution.cjs.map +1 -1
  330. package/_cjs/util/rand/distribution/UniformIntDistribution.cjs.map +1 -1
  331. package/_cjs/util/rand/distribution/internals/ArrayInt.cjs.map +1 -1
  332. package/_cjs/util/rand/distribution/internals/UniformArrayIntDistributionInternal.cjs.map +1 -1
  333. package/_cjs/util/rand/distribution/internals/UniformIntDistributionInternal.cjs.map +1 -1
  334. package/_cjs/util/rand/generator/MersenneTwister.cjs.map +1 -1
  335. package/_cjs/util/rand/generator/RandomGenerator.cjs.map +1 -1
  336. package/_cjs/util/rand.cjs.map +1 -1
  337. package/_mjs/collection/Iterable/api/traverseConc.mjs +5 -5
  338. package/_mjs/collection/Iterable/api/traverseConc.mjs.map +1 -1
  339. package/_mjs/collection/Iterable/api.mjs +465 -411
  340. package/_mjs/collection/Iterable/api.mjs.map +1 -1
  341. package/_mjs/collection/Iterable/constructors.mjs +5 -5
  342. package/_mjs/collection/Iterable/constructors.mjs.map +1 -1
  343. package/_mjs/collection/compat/Array/api.mjs +16 -12
  344. package/_mjs/collection/compat/Array/api.mjs.map +1 -1
  345. package/_mjs/collection/compat/Array/derivations.mjs +35 -19
  346. package/_mjs/collection/compat/Array/derivations.mjs.map +1 -1
  347. package/_mjs/collection/compat/ArrayLike/api.mjs +1 -1
  348. package/_mjs/collection/compat/ArrayLike/api.mjs.map +1 -1
  349. package/_mjs/collection/compat/Record/instances.mjs +34 -3
  350. package/_mjs/collection/compat/Record/instances.mjs.map +1 -1
  351. package/_mjs/collection/immutable/Conc/api/makeBy.mjs +1 -1
  352. package/_mjs/collection/immutable/Conc/api/makeBy.mjs.map +1 -1
  353. package/_mjs/collection/immutable/Conc/api.mjs +795 -697
  354. package/_mjs/collection/immutable/Conc/api.mjs.map +1 -1
  355. package/_mjs/collection/immutable/Conc/definition.mjs +53 -51
  356. package/_mjs/collection/immutable/Conc/definition.mjs.map +1 -1
  357. package/_mjs/collection/immutable/Conc/derivations.mjs +10 -2
  358. package/_mjs/collection/immutable/Conc/derivations.mjs.map +1 -1
  359. package/_mjs/collection/immutable/Conc.mjs.map +1 -1
  360. package/_mjs/collection/immutable/Dictionary/api.mjs +47 -35
  361. package/_mjs/collection/immutable/Dictionary/api.mjs.map +1 -1
  362. package/_mjs/collection/immutable/HashMap/api.mjs +295 -217
  363. package/_mjs/collection/immutable/HashMap/api.mjs.map +1 -1
  364. package/_mjs/collection/immutable/HashMap/definition.mjs +1 -1
  365. package/_mjs/collection/immutable/HashMap/definition.mjs.map +1 -1
  366. package/_mjs/collection/immutable/HashMap/internal.mjs.map +1 -1
  367. package/_mjs/collection/immutable/HashSet/api.mjs +206 -168
  368. package/_mjs/collection/immutable/HashSet/api.mjs.map +1 -1
  369. package/_mjs/collection/immutable/HashSet/definition.mjs +1 -1
  370. package/_mjs/collection/immutable/HashSet/definition.mjs.map +1 -1
  371. package/_mjs/collection/immutable/ImmutableArray/api/chunksOf.mjs +5 -3
  372. package/_mjs/collection/immutable/ImmutableArray/api/chunksOf.mjs.map +1 -1
  373. package/_mjs/collection/immutable/ImmutableArray/api/slice.mjs +5 -3
  374. package/_mjs/collection/immutable/ImmutableArray/api/slice.mjs.map +1 -1
  375. package/_mjs/collection/immutable/ImmutableArray/api/splitAt.mjs +5 -3
  376. package/_mjs/collection/immutable/ImmutableArray/api/splitAt.mjs.map +1 -1
  377. package/_mjs/collection/immutable/ImmutableArray/api/splitWhere.mjs +13 -11
  378. package/_mjs/collection/immutable/ImmutableArray/api/splitWhere.mjs.map +1 -1
  379. package/_mjs/collection/immutable/ImmutableArray/api.mjs +816 -629
  380. package/_mjs/collection/immutable/ImmutableArray/api.mjs.map +1 -1
  381. package/_mjs/collection/immutable/ImmutableArray/derivations.mjs +9 -1
  382. package/_mjs/collection/immutable/ImmutableArray/derivations.mjs.map +1 -1
  383. package/_mjs/collection/immutable/ImmutableArray/instances.mjs +34 -34
  384. package/_mjs/collection/immutable/ImmutableArray/instances.mjs.map +1 -1
  385. package/_mjs/collection/immutable/ImmutableArray.mjs.map +1 -1
  386. package/_mjs/collection/immutable/ImmutableNonEmptyArray/api.mjs +301 -239
  387. package/_mjs/collection/immutable/ImmutableNonEmptyArray/api.mjs.map +1 -1
  388. package/_mjs/collection/immutable/ImmutableNonEmptyArray/constructors.mjs.map +1 -1
  389. package/_mjs/collection/immutable/ImmutableNonEmptyArray/definition.mjs.map +1 -1
  390. package/_mjs/collection/immutable/ImmutableNonEmptyArray/derivations.mjs +12 -4
  391. package/_mjs/collection/immutable/ImmutableNonEmptyArray/derivations.mjs.map +1 -1
  392. package/_mjs/collection/immutable/ImmutableNonEmptyArray/destructors.mjs +2 -2
  393. package/_mjs/collection/immutable/ImmutableNonEmptyArray/destructors.mjs.map +1 -1
  394. package/_mjs/collection/immutable/ImmutableNonEmptyArray/instances.mjs +13 -13
  395. package/_mjs/collection/immutable/ImmutableNonEmptyArray/instances.mjs.map +1 -1
  396. package/_mjs/collection/immutable/List/api/foldLeft.mjs +11 -9
  397. package/_mjs/collection/immutable/List/api/foldLeft.mjs.map +1 -1
  398. package/_mjs/collection/immutable/List/api.mjs +157 -133
  399. package/_mjs/collection/immutable/List/api.mjs.map +1 -1
  400. package/_mjs/collection/immutable/List.mjs.map +1 -1
  401. package/_mjs/collection/immutable/Queue/api.mjs +55 -39
  402. package/_mjs/collection/immutable/Queue/api.mjs.map +1 -1
  403. package/_mjs/collection/immutable/Queue/definition.mjs +1 -1
  404. package/_mjs/collection/immutable/Queue/definition.mjs.map +1 -1
  405. package/_mjs/collection/immutable/RoseTree/api.mjs +50 -36
  406. package/_mjs/collection/immutable/RoseTree/api.mjs.map +1 -1
  407. package/_mjs/collection/immutable/RoseTree/definition.mjs.map +1 -1
  408. package/_mjs/collection/immutable/SortedMap/api.mjs +398 -358
  409. package/_mjs/collection/immutable/SortedMap/api.mjs.map +1 -1
  410. package/_mjs/collection/immutable/Vector/api.mjs +650 -538
  411. package/_mjs/collection/immutable/Vector/api.mjs.map +1 -1
  412. package/_mjs/collection/immutable/Vector/definition.mjs +16 -14
  413. package/_mjs/collection/immutable/Vector/definition.mjs.map +1 -1
  414. package/_mjs/collection/immutable/Vector/internal.mjs +40 -39
  415. package/_mjs/collection/immutable/Vector/internal.mjs.map +1 -1
  416. package/_mjs/collection/mutable/HashMap.mjs +3 -5
  417. package/_mjs/collection/mutable/HashMap.mjs.map +1 -1
  418. package/_mjs/collection/mutable/HashSet.mjs.map +1 -1
  419. package/_mjs/collection/mutable/ListBuffer.mjs +2 -2
  420. package/_mjs/collection/mutable/ListBuffer.mjs.map +1 -1
  421. package/_mjs/collection/mutable/internal.mjs +0 -2
  422. package/_mjs/collection/mutable/internal.mjs.map +1 -1
  423. package/_mjs/collection/weak/IterableWeakMap.mjs +7 -7
  424. package/_mjs/collection/weak/IterableWeakMap.mjs.map +1 -1
  425. package/_mjs/collection/weak/IterableWeakSet.mjs +7 -7
  426. package/_mjs/collection/weak/IterableWeakSet.mjs.map +1 -1
  427. package/_mjs/control/Eval/api.mjs +40 -28
  428. package/_mjs/control/Eval/api.mjs.map +1 -1
  429. package/_mjs/control/Eval/instance.mjs +5 -5
  430. package/_mjs/control/Eval/instance.mjs.map +1 -1
  431. package/_mjs/control/Eval/run.mjs +1 -1
  432. package/_mjs/control/Eval/run.mjs.map +1 -1
  433. package/_mjs/control/Z/api.mjs +196 -128
  434. package/_mjs/control/Z/api.mjs.map +1 -1
  435. package/_mjs/control/Z/instances.mjs +4 -4
  436. package/_mjs/control/Z/instances.mjs.map +1 -1
  437. package/_mjs/control/Z/runtime.mjs +244 -234
  438. package/_mjs/control/Z/runtime.mjs.map +1 -1
  439. package/_mjs/data/Branded/definition.mjs.map +1 -1
  440. package/_mjs/data/Branded/derivations.mjs +3 -3
  441. package/_mjs/data/Branded/derivations.mjs.map +1 -1
  442. package/_mjs/data/CaseClass.mjs.map +1 -1
  443. package/_mjs/data/Cause/api/fold.mjs +19 -17
  444. package/_mjs/data/Cause/api/fold.mjs.map +1 -1
  445. package/_mjs/data/Cause/api/isEmpty.mjs +1 -1
  446. package/_mjs/data/Cause/api/isEmpty.mjs.map +1 -1
  447. package/_mjs/data/Cause/api/linearize.mjs +8 -8
  448. package/_mjs/data/Cause/api/linearize.mjs.map +1 -1
  449. package/_mjs/data/Cause/api/prettyPrint.mjs +1 -1
  450. package/_mjs/data/Cause/api/prettyPrint.mjs.map +1 -1
  451. package/_mjs/data/Cause/api.mjs +149 -129
  452. package/_mjs/data/Cause/api.mjs.map +1 -1
  453. package/_mjs/data/Cause/definition.mjs +18 -18
  454. package/_mjs/data/Cause/definition.mjs.map +1 -1
  455. package/_mjs/data/Cause.mjs.map +1 -1
  456. package/_mjs/data/Const/api.mjs +6 -4
  457. package/_mjs/data/Const/api.mjs.map +1 -1
  458. package/_mjs/data/Const/instances.mjs +4 -4
  459. package/_mjs/data/Const/instances.mjs.map +1 -1
  460. package/_mjs/data/Datum/api.mjs +220 -179
  461. package/_mjs/data/Datum/api.mjs.map +1 -1
  462. package/_mjs/data/Datum/definition.mjs.map +1 -1
  463. package/_mjs/data/DatumEither/api.mjs +163 -132
  464. package/_mjs/data/DatumEither/api.mjs.map +1 -1
  465. package/_mjs/data/DecodeError/definition.mjs +14 -14
  466. package/_mjs/data/DecodeError/definition.mjs.map +1 -1
  467. package/_mjs/data/Decoder/api.mjs +9 -7
  468. package/_mjs/data/Decoder/api.mjs.map +1 -1
  469. package/_mjs/data/Duration/api.mjs +16 -10
  470. package/_mjs/data/Duration/api.mjs.map +1 -1
  471. package/_mjs/data/Either/api/align.mjs +8 -2
  472. package/_mjs/data/Either/api/align.mjs.map +1 -1
  473. package/_mjs/data/Either/api/alignWith.mjs +13 -11
  474. package/_mjs/data/Either/api/alignWith.mjs.map +1 -1
  475. package/_mjs/data/Either/api.mjs +175 -136
  476. package/_mjs/data/Either/api.mjs.map +1 -1
  477. package/_mjs/data/Either/constructors.mjs +7 -5
  478. package/_mjs/data/Either/constructors.mjs.map +1 -1
  479. package/_mjs/data/Either/destructors.mjs +15 -13
  480. package/_mjs/data/Either/destructors.mjs.map +1 -1
  481. package/_mjs/data/Either/instances.mjs +9 -9
  482. package/_mjs/data/Either/instances.mjs.map +1 -1
  483. package/_mjs/data/EitherT/api.mjs +8 -8
  484. package/_mjs/data/EitherT/api.mjs.map +1 -1
  485. package/_mjs/data/Encoder/api.mjs +102 -0
  486. package/_mjs/data/Encoder/api.mjs.map +1 -0
  487. package/_mjs/data/Encoder/definition.mjs +15 -0
  488. package/_mjs/data/Encoder/definition.mjs.map +1 -0
  489. package/_mjs/data/Encoder.mjs +4 -0
  490. package/_mjs/data/Encoder.mjs.map +1 -0
  491. package/_mjs/data/Environment/api.mjs +45 -33
  492. package/_mjs/data/Environment/api.mjs.map +1 -1
  493. package/_mjs/data/EnvironmentPatch.mjs +17 -13
  494. package/_mjs/data/EnvironmentPatch.mjs.map +1 -1
  495. package/_mjs/data/ExecutionStrategy.mjs +19 -27
  496. package/_mjs/data/ExecutionStrategy.mjs.map +1 -1
  497. package/_mjs/data/Exit/api.mjs +140 -108
  498. package/_mjs/data/Exit/api.mjs.map +1 -1
  499. package/_mjs/data/Exit/constructors.mjs +3 -3
  500. package/_mjs/data/Exit/constructors.mjs.map +1 -1
  501. package/_mjs/data/FiberId/api.mjs +22 -20
  502. package/_mjs/data/FiberId/api.mjs.map +1 -1
  503. package/_mjs/data/FiberId/constructors.mjs.map +1 -1
  504. package/_mjs/data/Identity/api.mjs +21 -13
  505. package/_mjs/data/Identity/api.mjs.map +1 -1
  506. package/_mjs/data/Identity/instances.mjs +4 -4
  507. package/_mjs/data/Identity/instances.mjs.map +1 -1
  508. package/_mjs/data/Interval.mjs +38 -28
  509. package/_mjs/data/Interval.mjs.map +1 -1
  510. package/_mjs/data/Intervals.mjs +35 -27
  511. package/_mjs/data/Intervals.mjs.map +1 -1
  512. package/_mjs/data/Maybe/api.mjs +141 -106
  513. package/_mjs/data/Maybe/api.mjs.map +1 -1
  514. package/_mjs/data/Maybe/constructors.mjs +1 -1
  515. package/_mjs/data/Maybe/constructors.mjs.map +1 -1
  516. package/_mjs/data/Maybe/definition.mjs.map +1 -1
  517. package/_mjs/data/Maybe/destructors.mjs +8 -6
  518. package/_mjs/data/Maybe/destructors.mjs.map +1 -1
  519. package/_mjs/data/Maybe/instances.mjs +12 -12
  520. package/_mjs/data/Maybe/instances.mjs.map +1 -1
  521. package/_mjs/data/Predicate/api.mjs +10 -8
  522. package/_mjs/data/Predicate/api.mjs.map +1 -1
  523. package/_mjs/data/Refinement/api.mjs +15 -9
  524. package/_mjs/data/Refinement/api.mjs.map +1 -1
  525. package/_mjs/data/Struct/api.mjs +56 -44
  526. package/_mjs/data/Struct/api.mjs.map +1 -1
  527. package/_mjs/data/Tag/constructors.mjs +3 -2
  528. package/_mjs/data/Tag/constructors.mjs.map +1 -1
  529. package/_mjs/data/Tag/definition.mjs +0 -2
  530. package/_mjs/data/Tag/definition.mjs.map +1 -1
  531. package/_mjs/data/These/api.mjs +187 -169
  532. package/_mjs/data/These/api.mjs.map +1 -1
  533. package/_mjs/data/These/constructors.mjs +1 -1
  534. package/_mjs/data/These/constructors.mjs.map +1 -1
  535. package/_mjs/data/These/destructors.mjs +35 -31
  536. package/_mjs/data/These/destructors.mjs.map +1 -1
  537. package/_mjs/data/These/instances.mjs +1 -1
  538. package/_mjs/data/These/instances.mjs.map +1 -1
  539. package/_mjs/data/Trace/api.mjs +6 -4
  540. package/_mjs/data/Trace/api.mjs.map +1 -1
  541. package/_mjs/data/Zipped.mjs.map +1 -1
  542. package/_mjs/data/function/api.mjs +5 -3
  543. package/_mjs/data/function/api.mjs.map +1 -1
  544. package/_mjs/data/function/pipe.mjs +7 -0
  545. package/_mjs/data/function/pipe.mjs.map +1 -1
  546. package/_mjs/data/string/api.mjs +46 -66
  547. package/_mjs/data/string/api.mjs.map +1 -1
  548. package/_mjs/global/api.mjs +4 -2
  549. package/_mjs/global/api.mjs.map +1 -1
  550. package/_mjs/internal/AtomicBoolean.mjs.map +1 -1
  551. package/_mjs/internal/AtomicNumber.mjs.map +1 -1
  552. package/_mjs/internal/AtomicReference.mjs.map +1 -1
  553. package/_mjs/internal/Stack.mjs +1 -1
  554. package/_mjs/internal/Stack.mjs.map +1 -1
  555. package/_mjs/optics/At/api.mjs +1 -1
  556. package/_mjs/optics/At/api.mjs.map +1 -1
  557. package/_mjs/optics/At/definition.mjs +2 -2
  558. package/_mjs/optics/At/definition.mjs.map +1 -1
  559. package/_mjs/optics/Fold/definition.mjs +2 -3
  560. package/_mjs/optics/Fold/definition.mjs.map +1 -1
  561. package/_mjs/optics/Getter/definition.mjs +1 -2
  562. package/_mjs/optics/Getter/definition.mjs.map +1 -1
  563. package/_mjs/optics/Index/api.mjs +4 -4
  564. package/_mjs/optics/Index/api.mjs.map +1 -1
  565. package/_mjs/optics/Index/definition.mjs +1 -1
  566. package/_mjs/optics/Index/definition.mjs.map +1 -1
  567. package/_mjs/optics/Iso/api.mjs +8 -6
  568. package/_mjs/optics/Iso/api.mjs.map +1 -1
  569. package/_mjs/optics/Iso/definition.mjs +9 -9
  570. package/_mjs/optics/Iso/definition.mjs.map +1 -1
  571. package/_mjs/optics/Lens/api.mjs +49 -39
  572. package/_mjs/optics/Lens/api.mjs.map +1 -1
  573. package/_mjs/optics/Lens/definition.mjs +7 -7
  574. package/_mjs/optics/Lens/definition.mjs.map +1 -1
  575. package/_mjs/optics/Optional/api/compose.mjs +8 -6
  576. package/_mjs/optics/Optional/api/compose.mjs.map +1 -1
  577. package/_mjs/optics/Optional/definition.mjs +8 -10
  578. package/_mjs/optics/Optional/definition.mjs.map +1 -1
  579. package/_mjs/optics/Optional.mjs.map +1 -1
  580. package/_mjs/optics/Prism/api/compose.mjs +8 -6
  581. package/_mjs/optics/Prism/api/compose.mjs.map +1 -1
  582. package/_mjs/optics/Prism/api/fromNullable.mjs +2 -2
  583. package/_mjs/optics/Prism/api/fromNullable.mjs.map +1 -1
  584. package/_mjs/optics/Prism/api/just.mjs +2 -2
  585. package/_mjs/optics/Prism/api/just.mjs.map +1 -1
  586. package/_mjs/optics/Prism/definition.mjs +6 -6
  587. package/_mjs/optics/Prism/definition.mjs.map +1 -1
  588. package/_mjs/optics/Prism.mjs.map +1 -1
  589. package/_mjs/optics/Setter/definition.mjs +5 -10
  590. package/_mjs/optics/Setter/definition.mjs.map +1 -1
  591. package/_mjs/optics/Traversal/api/compose.mjs +7 -5
  592. package/_mjs/optics/Traversal/api/compose.mjs.map +1 -1
  593. package/_mjs/optics/Traversal/api/fromTraversable.mjs +2 -2
  594. package/_mjs/optics/Traversal/api/fromTraversable.mjs.map +1 -1
  595. package/_mjs/optics/Traversal/definition.mjs +9 -9
  596. package/_mjs/optics/Traversal/definition.mjs.map +1 -1
  597. package/_mjs/optics/Traversal.mjs.map +1 -1
  598. package/_mjs/typeclass/Align.mjs.map +1 -1
  599. package/_mjs/typeclass/Alt.mjs.map +1 -1
  600. package/_mjs/typeclass/Applicative.mjs.map +1 -1
  601. package/_mjs/typeclass/ApplicativeExcept.mjs +6 -10
  602. package/_mjs/typeclass/ApplicativeExcept.mjs.map +1 -1
  603. package/_mjs/typeclass/Apply.mjs +9 -9
  604. package/_mjs/typeclass/Apply.mjs.map +1 -1
  605. package/_mjs/typeclass/Chain.mjs +5 -5
  606. package/_mjs/typeclass/Chain.mjs.map +1 -1
  607. package/_mjs/typeclass/Eq/definition.mjs.map +1 -1
  608. package/_mjs/typeclass/Eq/derivations.mjs.map +1 -1
  609. package/_mjs/typeclass/Equatable/api.mjs.map +1 -1
  610. package/_mjs/typeclass/Equatable/definition.mjs.map +1 -1
  611. package/_mjs/typeclass/Equatable/fast-equals.mjs.map +1 -1
  612. package/_mjs/typeclass/Filterable.mjs.map +1 -1
  613. package/_mjs/typeclass/FilterableWithIndex.mjs.map +1 -1
  614. package/_mjs/typeclass/Foldable.mjs +1 -1
  615. package/_mjs/typeclass/Foldable.mjs.map +1 -1
  616. package/_mjs/typeclass/FoldableWithIndex.mjs +1 -1
  617. package/_mjs/typeclass/FoldableWithIndex.mjs.map +1 -1
  618. package/_mjs/typeclass/Functor.mjs.map +1 -1
  619. package/_mjs/typeclass/FunctorWithIndex.mjs.map +1 -1
  620. package/_mjs/typeclass/Guard/api.mjs +18 -10
  621. package/_mjs/typeclass/Guard/api.mjs.map +1 -1
  622. package/_mjs/typeclass/Guard/definition.mjs.map +1 -1
  623. package/_mjs/typeclass/Guard/derivations.mjs.map +1 -1
  624. package/_mjs/typeclass/Has.mjs +7 -5
  625. package/_mjs/typeclass/Has.mjs.map +1 -1
  626. package/_mjs/typeclass/HashEq.mjs.map +1 -1
  627. package/_mjs/typeclass/Hashable/definition.mjs.map +1 -1
  628. package/_mjs/typeclass/Hashable/hash.mjs.map +1 -1
  629. package/_mjs/typeclass/MonadExcept.mjs +1 -1
  630. package/_mjs/typeclass/MonadExcept.mjs.map +1 -1
  631. package/_mjs/typeclass/Ord/api/contramap.mjs +7 -5
  632. package/_mjs/typeclass/Ord/api/contramap.mjs.map +1 -1
  633. package/_mjs/typeclass/Ord/api/max.mjs.map +1 -1
  634. package/_mjs/typeclass/Ord/api/min.mjs.map +1 -1
  635. package/_mjs/typeclass/Ord/definition.mjs.map +1 -1
  636. package/_mjs/typeclass/Ord/instances.mjs.map +1 -1
  637. package/_mjs/typeclass/Ordering.mjs.map +1 -1
  638. package/_mjs/typeclass/Semialign.mjs +7 -7
  639. package/_mjs/typeclass/Semialign.mjs.map +1 -1
  640. package/_mjs/typeclass/Semigroup/api.mjs.map +1 -1
  641. package/_mjs/typeclass/Semigroup/definition.mjs.map +1 -1
  642. package/_mjs/typeclass/Semigroup/derivations.mjs.map +1 -1
  643. package/_mjs/typeclass/Semimonoidal.mjs.map +1 -1
  644. package/_mjs/typeclass/Showable/definition.mjs.map +1 -1
  645. package/_mjs/typeclass/Showable/show.mjs +107 -107
  646. package/_mjs/typeclass/Showable/show.mjs.map +1 -1
  647. package/_mjs/typeclass/Showable/styles.mjs.map +1 -1
  648. package/_mjs/typeclass/Showable/util.mjs +1 -1
  649. package/_mjs/typeclass/Showable/util.mjs.map +1 -1
  650. package/_mjs/typeclass/Traversable.mjs +1 -2
  651. package/_mjs/typeclass/Traversable.mjs.map +1 -1
  652. package/_mjs/typeclass/TraversableWithIndex.mjs.map +1 -1
  653. package/_mjs/typeclass/Witherable.mjs +2 -1
  654. package/_mjs/typeclass/Witherable.mjs.map +1 -1
  655. package/_mjs/typeclass/WitherableWithIndex.mjs +2 -1
  656. package/_mjs/typeclass/WitherableWithIndex.mjs.map +1 -1
  657. package/_mjs/util/AnsiFormat.mjs +11 -11
  658. package/_mjs/util/AnsiFormat.mjs.map +1 -1
  659. package/_mjs/util/PCGRandom.mjs.map +1 -1
  660. package/_mjs/util/assert.mjs.map +1 -1
  661. package/_mjs/util/pattern.mjs.map +1 -1
  662. package/_mjs/util/predicates.mjs.map +1 -1
  663. package/_mjs/util/rand/Random.mjs.map +1 -1
  664. package/_mjs/util/rand/distribution/UniformArrayIntDistribution.mjs.map +1 -1
  665. package/_mjs/util/rand/distribution/UniformBigIntDistribution.mjs.map +1 -1
  666. package/_mjs/util/rand/distribution/UniformIntDistribution.mjs.map +1 -1
  667. package/_mjs/util/rand/distribution/internals/ArrayInt.mjs.map +1 -1
  668. package/_mjs/util/rand/distribution/internals/UniformArrayIntDistributionInternal.mjs.map +1 -1
  669. package/_mjs/util/rand/distribution/internals/UniformIntDistributionInternal.mjs.map +1 -1
  670. package/_mjs/util/rand/generator/MersenneTwister.mjs.map +1 -1
  671. package/_mjs/util/rand/generator/RandomGenerator.mjs.map +1 -1
  672. package/_mjs/util/rand.mjs.map +1 -1
  673. package/_src/collection/Iterable/api/traverseConc.ts +3 -3
  674. package/_src/collection/Iterable/api.ts +445 -408
  675. package/_src/collection/Iterable/constructors.ts +1 -1
  676. package/_src/collection/compat/Array/api.ts +16 -13
  677. package/_src/collection/compat/Array/derivations.ts +27 -1
  678. package/_src/collection/compat/Record/instances.ts +51 -2
  679. package/_src/collection/immutable/Conc/api.ts +716 -607
  680. package/_src/collection/immutable/Conc/definition.ts +60 -68
  681. package/_src/collection/immutable/Conc/derivations.ts +13 -0
  682. package/_src/collection/immutable/Conc.ts +0 -1
  683. package/_src/collection/immutable/Dictionary/api.ts +44 -32
  684. package/_src/collection/immutable/HashMap/api.ts +338 -224
  685. package/_src/collection/immutable/HashMap/internal.ts +3 -7
  686. package/_src/collection/immutable/HashSet/api.ts +193 -158
  687. package/_src/collection/immutable/ImmutableArray/api/chunksOf.ts +5 -3
  688. package/_src/collection/immutable/ImmutableArray/api/slice.ts +5 -3
  689. package/_src/collection/immutable/ImmutableArray/api/splitAt.ts +5 -3
  690. package/_src/collection/immutable/ImmutableArray/api/splitWhere.ts +13 -14
  691. package/_src/collection/immutable/ImmutableArray/api.ts +870 -722
  692. package/_src/collection/immutable/ImmutableArray/derivations.ts +13 -0
  693. package/_src/collection/immutable/ImmutableArray/instances.ts +54 -73
  694. package/_src/collection/immutable/ImmutableArray.ts +0 -1
  695. package/_src/collection/immutable/ImmutableNonEmptyArray/api.ts +311 -273
  696. package/_src/collection/immutable/ImmutableNonEmptyArray/constructors.ts +19 -4
  697. package/_src/collection/immutable/ImmutableNonEmptyArray/definition.ts +0 -1
  698. package/_src/collection/immutable/ImmutableNonEmptyArray/derivations.ts +13 -0
  699. package/_src/collection/immutable/ImmutableNonEmptyArray/instances.ts +22 -23
  700. package/_src/collection/immutable/List/api/foldLeft.ts +11 -9
  701. package/_src/collection/immutable/List/api.ts +147 -133
  702. package/_src/collection/immutable/List.ts +0 -1
  703. package/_src/collection/immutable/Queue/api.ts +53 -37
  704. package/_src/collection/immutable/Queue/definition.ts +0 -1
  705. package/_src/collection/immutable/RoseTree/api.ts +38 -32
  706. package/_src/collection/immutable/RoseTree/definition.ts +2 -0
  707. package/_src/collection/immutable/SortedMap/api.ts +364 -332
  708. package/_src/collection/immutable/Vector/api.ts +608 -482
  709. package/_src/collection/immutable/Vector/definition.ts +11 -12
  710. package/_src/collection/immutable/Vector/internal.ts +37 -38
  711. package/_src/collection/mutable/HashMap.ts +1 -4
  712. package/_src/collection/mutable/HashSet.ts +1 -2
  713. package/_src/collection/mutable/ListBuffer.ts +1 -1
  714. package/_src/collection/mutable/internal.ts +0 -2
  715. package/_src/collection/weak/IterableWeakMap.ts +11 -7
  716. package/_src/collection/weak/IterableWeakSet.ts +10 -5
  717. package/_src/control/Eval/api.ts +35 -19
  718. package/_src/control/Eval/instance.ts +5 -5
  719. package/_src/control/Z/api.ts +191 -208
  720. package/_src/control/Z/instances.ts +4 -5
  721. package/_src/control/Z/runtime.ts +190 -189
  722. package/_src/data/Branded/definition.ts +11 -12
  723. package/_src/data/Branded/derivations.ts +2 -2
  724. package/_src/data/CaseClass.ts +4 -1
  725. package/_src/data/Cause/api/fold.ts +13 -14
  726. package/_src/data/Cause/api.ts +125 -105
  727. package/_src/data/Cause.ts +0 -1
  728. package/_src/data/Const/api.ts +6 -4
  729. package/_src/data/Const/instances.ts +3 -3
  730. package/_src/data/Datum/api.ts +229 -197
  731. package/_src/data/Datum/definition.ts +2 -5
  732. package/_src/data/DatumEither/api.ts +208 -193
  733. package/_src/data/Decoder/api.ts +5 -3
  734. package/_src/data/Duration/api.ts +19 -15
  735. package/_src/data/Either/api/align.ts +7 -2
  736. package/_src/data/Either/api/alignWith.ts +13 -15
  737. package/_src/data/Either/api.ts +141 -119
  738. package/_src/data/Either/constructors.ts +12 -10
  739. package/_src/data/Either/destructors.ts +11 -9
  740. package/_src/data/Either/instances.ts +24 -20
  741. package/_src/data/EitherT/api.ts +43 -49
  742. package/_src/data/Encoder/api.ts +123 -0
  743. package/_src/data/Encoder/definition.ts +12 -0
  744. package/_src/data/Encoder.ts +4 -0
  745. package/_src/data/Environment/api.ts +52 -44
  746. package/_src/data/EnvironmentPatch.ts +10 -9
  747. package/_src/data/ExecutionStrategy.ts +14 -24
  748. package/_src/data/Exit/api.ts +104 -73
  749. package/_src/data/Exit/constructors.ts +2 -2
  750. package/_src/data/FiberId/api.ts +19 -17
  751. package/_src/data/FiberId/constructors.ts +1 -2
  752. package/_src/data/Identity/api.ts +20 -12
  753. package/_src/data/Identity/instances.ts +4 -7
  754. package/_src/data/Interval.ts +39 -29
  755. package/_src/data/Intervals.ts +31 -23
  756. package/_src/data/Maybe/api.ts +112 -79
  757. package/_src/data/Maybe/constructors.ts +3 -3
  758. package/_src/data/Maybe/definition.ts +11 -1
  759. package/_src/data/Maybe/destructors.ts +6 -4
  760. package/_src/data/Maybe/instances.ts +10 -21
  761. package/_src/data/Predicate/api.ts +14 -8
  762. package/_src/data/Refinement/api.ts +19 -13
  763. package/_src/data/Struct/api.ts +75 -55
  764. package/_src/data/Tag/constructors.ts +1 -2
  765. package/_src/data/Tag/definition.ts +0 -1
  766. package/_src/data/These/api.ts +114 -114
  767. package/_src/data/These/destructors.ts +23 -24
  768. package/_src/data/Trace/api.ts +5 -3
  769. package/_src/data/Zipped.ts +3 -4
  770. package/_src/data/function/api.ts +6 -7
  771. package/_src/data/function/pipe.ts +9 -1
  772. package/_src/data/string/api.ts +40 -60
  773. package/_src/data.ts +1 -0
  774. package/_src/global/api.ts +7 -12
  775. package/_src/global.ts +4 -0
  776. package/_src/internal/AtomicBoolean.ts +0 -1
  777. package/_src/internal/AtomicNumber.ts +0 -7
  778. package/_src/internal/AtomicReference.ts +0 -4
  779. package/_src/internal/Stack.ts +1 -7
  780. package/_src/optics/At/definition.ts +5 -3
  781. package/_src/optics/Fold/definition.ts +3 -10
  782. package/_src/optics/Getter/definition.ts +1 -2
  783. package/_src/optics/Index/definition.ts +1 -1
  784. package/_src/optics/Iso/api.ts +8 -6
  785. package/_src/optics/Iso/definition.ts +3 -3
  786. package/_src/optics/Lens/api.ts +44 -42
  787. package/_src/optics/Lens/definition.ts +5 -5
  788. package/_src/optics/Optional/api/compose.ts +9 -9
  789. package/_src/optics/Optional/definition.ts +9 -16
  790. package/_src/optics/Optional.ts +0 -1
  791. package/_src/optics/Prism/api/compose.ts +9 -6
  792. package/_src/optics/Prism/definition.ts +3 -3
  793. package/_src/optics/Prism.ts +0 -1
  794. package/_src/optics/Setter/definition.ts +3 -23
  795. package/_src/optics/Traversal/api/compose.ts +7 -8
  796. package/_src/optics/Traversal/api/fromTraversable.ts +1 -1
  797. package/_src/optics/Traversal/definition.ts +10 -15
  798. package/_src/optics/Traversal.ts +0 -1
  799. package/_src/typeclass/Align.ts +0 -3
  800. package/_src/typeclass/Alt.ts +2 -1
  801. package/_src/typeclass/Applicative.ts +0 -1
  802. package/_src/typeclass/ApplicativeExcept.ts +15 -10
  803. package/_src/typeclass/Apply.ts +30 -33
  804. package/_src/typeclass/Chain.ts +9 -12
  805. package/_src/typeclass/Eq/definition.ts +0 -3
  806. package/_src/typeclass/Eq/derivations.ts +0 -2
  807. package/_src/typeclass/Equatable/api.ts +0 -2
  808. package/_src/typeclass/Equatable/definition.ts +0 -4
  809. package/_src/typeclass/Equatable/fast-equals.ts +11 -93
  810. package/_src/typeclass/Filterable.ts +19 -13
  811. package/_src/typeclass/FilterableWithIndex.ts +19 -13
  812. package/_src/typeclass/Foldable.ts +7 -10
  813. package/_src/typeclass/FoldableWithIndex.ts +7 -10
  814. package/_src/typeclass/Functor.ts +6 -4
  815. package/_src/typeclass/FunctorWithIndex.ts +3 -2
  816. package/_src/typeclass/Guard/api.ts +21 -16
  817. package/_src/typeclass/Guard/definition.ts +0 -3
  818. package/_src/typeclass/Guard/derivations.ts +5 -6
  819. package/_src/typeclass/Has.ts +6 -4
  820. package/_src/typeclass/HashEq.ts +0 -7
  821. package/_src/typeclass/Hashable/definition.ts +0 -4
  822. package/_src/typeclass/Hashable/hash.ts +0 -26
  823. package/_src/typeclass/MonadExcept.ts +1 -1
  824. package/_src/typeclass/Ord/api/contramap.ts +7 -6
  825. package/_src/typeclass/Ord/api/max.ts +0 -1
  826. package/_src/typeclass/Ord/api/min.ts +0 -1
  827. package/_src/typeclass/Ord/definition.ts +0 -4
  828. package/_src/typeclass/Ord/instances.ts +0 -2
  829. package/_src/typeclass/Ordering.ts +2 -0
  830. package/_src/typeclass/Semialign.ts +43 -32
  831. package/_src/typeclass/Semigroup/api.ts +0 -2
  832. package/_src/typeclass/Semigroup/definition.ts +0 -4
  833. package/_src/typeclass/Semigroup/derivations.ts +0 -2
  834. package/_src/typeclass/Semimonoidal.ts +3 -2
  835. package/_src/typeclass/Showable/definition.ts +0 -6
  836. package/_src/typeclass/Showable/show.ts +1 -57
  837. package/_src/typeclass/Showable/styles.ts +0 -8
  838. package/_src/typeclass/Showable/util.ts +22 -57
  839. package/_src/typeclass/Traversable.ts +13 -18
  840. package/_src/typeclass/TraversableWithIndex.ts +5 -7
  841. package/_src/typeclass/Witherable.ts +21 -13
  842. package/_src/typeclass/WitherableWithIndex.ts +26 -17
  843. package/_src/typeclass/builtin/Symbol.ts +0 -1
  844. package/_src/types/extractions.ts +12 -3
  845. package/_src/types/utility.ts +3 -5
  846. package/_src/util/AnsiFormat.ts +0 -25
  847. package/_src/util/PCGRandom.ts +4 -9
  848. package/_src/util/assert.ts +1 -2
  849. package/_src/util/pattern.ts +91 -12
  850. package/_src/util/predicates.ts +3 -1
  851. package/_src/util/rand/Random.ts +12 -16
  852. package/_src/util/rand/distribution/Distribution.ts +0 -1
  853. package/_src/util/rand/distribution/UniformArrayIntDistribution.ts +0 -3
  854. package/_src/util/rand/distribution/UniformBigIntDistribution.ts +0 -5
  855. package/_src/util/rand/distribution/UniformIntDistribution.ts +0 -7
  856. package/_src/util/rand/distribution/internals/ArrayInt.ts +3 -13
  857. package/_src/util/rand/distribution/internals/UniformArrayIntDistributionInternal.ts +0 -3
  858. package/_src/util/rand/distribution/internals/UniformIntDistributionInternal.ts +0 -4
  859. package/_src/util/rand/generator/MersenneTwister.ts +6 -29
  860. package/_src/util/rand/generator/RandomGenerator.ts +0 -3
  861. package/_src/util/rand.ts +0 -2
  862. package/collection/Iterable/api/traverseConc.d.ts +2 -2
  863. package/collection/Iterable/api.d.ts +64 -64
  864. package/collection/Iterable/constructors.d.ts +1 -1
  865. package/collection/compat/Array/api.d.ts +6 -6
  866. package/collection/compat/Array/derivations.d.ts +11 -0
  867. package/collection/compat/Record/instances.d.ts +30 -6
  868. package/collection/immutable/Conc/api.d.ts +108 -105
  869. package/collection/immutable/Conc/definition.d.ts +2 -2
  870. package/collection/immutable/Conc/derivations.d.ts +6 -0
  871. package/collection/immutable/Dictionary/api.d.ts +12 -12
  872. package/collection/immutable/HashMap/api.d.ts +76 -70
  873. package/collection/immutable/HashSet/api.d.ts +45 -41
  874. package/collection/immutable/ImmutableArray/api/chunksOf.d.ts +2 -2
  875. package/collection/immutable/ImmutableArray/api/slice.d.ts +2 -2
  876. package/collection/immutable/ImmutableArray/api/splitAt.d.ts +2 -2
  877. package/collection/immutable/ImmutableArray/api/splitWhere.d.ts +3 -3
  878. package/collection/immutable/ImmutableArray/api.d.ts +206 -206
  879. package/collection/immutable/ImmutableArray/derivations.d.ts +6 -0
  880. package/collection/immutable/ImmutableNonEmptyArray/api.d.ts +64 -63
  881. package/collection/immutable/ImmutableNonEmptyArray/derivations.d.ts +6 -0
  882. package/collection/immutable/List/api/foldLeft.d.ts +2 -2
  883. package/collection/immutable/List/api.d.ts +24 -24
  884. package/collection/immutable/Queue/api.d.ts +16 -16
  885. package/collection/immutable/RoseTree/api.d.ts +14 -14
  886. package/collection/immutable/SortedMap/api.d.ts +41 -41
  887. package/collection/immutable/Vector/api.d.ts +121 -117
  888. package/collection/immutable/Vector/definition.d.ts +2 -2
  889. package/collection/immutable/Vector/internal.d.ts +2 -2
  890. package/collection/mutable/ListBuffer.d.ts +1 -1
  891. package/control/Eval/api.d.ts +12 -12
  892. package/control/Z/api.d.ts +68 -68
  893. package/control/Z/runtime.d.ts +10 -10
  894. package/data/Branded/derivations.d.ts +2 -2
  895. package/data/Cause/api/fold.d.ts +3 -3
  896. package/data/Cause/api.d.ts +20 -20
  897. package/data/Const/api.d.ts +3 -3
  898. package/data/Datum/api.d.ts +43 -41
  899. package/data/DatumEither/api.d.ts +48 -46
  900. package/data/Decoder/api.d.ts +2 -2
  901. package/data/Duration/api.d.ts +7 -7
  902. package/data/Either/api/align.d.ts +5 -1
  903. package/data/Either/api/alignWith.d.ts +2 -2
  904. package/data/Either/api.d.ts +40 -46
  905. package/data/Either/constructors.d.ts +6 -6
  906. package/data/Either/destructors.d.ts +2 -2
  907. package/data/EitherT/api.d.ts +6 -6
  908. package/data/Encoder/api.d.ts +73 -0
  909. package/data/Encoder/definition.d.ts +12 -0
  910. package/data/Encoder.d.ts +2 -0
  911. package/data/Environment/api.d.ts +14 -14
  912. package/data/EnvironmentPatch.d.ts +4 -4
  913. package/data/ExecutionStrategy.d.ts +1 -6
  914. package/data/Exit/api.d.ts +32 -32
  915. package/data/Exit/constructors.d.ts +2 -2
  916. package/data/FiberId/api.d.ts +2 -2
  917. package/data/Identity/api.d.ts +8 -8
  918. package/data/Interval.d.ts +11 -11
  919. package/data/Intervals.d.ts +11 -11
  920. package/data/Maybe/api.d.ts +36 -37
  921. package/data/Maybe/constructors.d.ts +2 -2
  922. package/data/Maybe/definition.d.ts +7 -3
  923. package/data/Maybe/destructors.d.ts +2 -2
  924. package/data/Predicate/api.d.ts +5 -5
  925. package/data/Refinement/api.d.ts +9 -9
  926. package/data/Struct/api.d.ts +13 -23
  927. package/data/Tag/constructors.d.ts +1 -2
  928. package/data/Tag/definition.d.ts +0 -1
  929. package/data/These/api.d.ts +18 -22
  930. package/data/These/destructors.d.ts +4 -4
  931. package/data/Trace/api.d.ts +2 -2
  932. package/data/function/api.d.ts +3 -3
  933. package/data/function/pipe.d.ts +7 -1
  934. package/data/string/api.d.ts +9 -49
  935. package/data.d.ts +1 -0
  936. package/global/api.d.ts +3 -3
  937. package/global.d.ts +4 -0
  938. package/internal/Stack.d.ts +1 -1
  939. package/optics/At/definition.d.ts +1 -1
  940. package/optics/Fold/definition.d.ts +2 -6
  941. package/optics/Getter/definition.d.ts +1 -1
  942. package/optics/Index/definition.d.ts +1 -1
  943. package/optics/Iso/api.d.ts +2 -2
  944. package/optics/Iso/definition.d.ts +2 -2
  945. package/optics/Lens/api.d.ts +10 -10
  946. package/optics/Lens/definition.d.ts +4 -4
  947. package/optics/Optional/api/compose.d.ts +2 -2
  948. package/optics/Optional/definition.d.ts +4 -8
  949. package/optics/Prism/api/compose.d.ts +2 -2
  950. package/optics/Prism/definition.d.ts +2 -2
  951. package/optics/Setter/definition.d.ts +2 -14
  952. package/optics/Traversal/api/compose.d.ts +2 -2
  953. package/optics/Traversal/definition.d.ts +4 -4
  954. package/package.json +1 -1
  955. package/typeclass/Alt.d.ts +1 -1
  956. package/typeclass/ApplicativeExcept.d.ts +2 -6
  957. package/typeclass/Apply.d.ts +5 -5
  958. package/typeclass/Chain.d.ts +4 -4
  959. package/typeclass/Filterable.d.ts +6 -6
  960. package/typeclass/FilterableWithIndex.d.ts +6 -6
  961. package/typeclass/Foldable.d.ts +4 -4
  962. package/typeclass/FoldableWithIndex.d.ts +4 -4
  963. package/typeclass/Functor.d.ts +2 -2
  964. package/typeclass/FunctorWithIndex.d.ts +1 -1
  965. package/typeclass/Guard/api.d.ts +7 -7
  966. package/typeclass/Has.d.ts +3 -3
  967. package/typeclass/Ord/api/contramap.d.ts +2 -2
  968. package/typeclass/Semialign.d.ts +14 -14
  969. package/typeclass/Semimonoidal.d.ts +1 -1
  970. package/typeclass/Traversable.d.ts +4 -6
  971. package/typeclass/TraversableWithIndex.d.ts +2 -2
  972. package/typeclass/Witherable.d.ts +3 -3
  973. package/typeclass/WitherableWithIndex.d.ts +5 -5
  974. package/types/extractions.d.ts +10 -6
  975. package/util/assert.d.ts +1 -1
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable prefer-const */
2
2
  import type { MutableVector, VectorF } from "@fncts/base/collection/immutable/Vector/definition";
3
3
  import type { Eq, Monoid, Ord, Ordering, Traversable } from "@fncts/base/typeclass";
4
+ import type * as P from "@fncts/base/typeclass";
4
5
 
5
6
  import {
6
7
  affixPush,
@@ -48,115 +49,122 @@ import {
48
49
  updateNode,
49
50
  zeroOffset,
50
51
  } from "@fncts/base/collection/immutable/Vector/internal";
51
- import { TraversableWithIndex } from "@fncts/base/typeclass";
52
52
 
53
53
  /**
54
54
  * Appends an element to the end of a Vector and returns the new Vector.
55
55
  *
56
56
  * @complexity O(n)
57
57
  *
58
- * @tsplus fluent fncts.Vector append
59
- * @tsplus operator fncts.Vector +
60
- */
61
- export function append_<A>(as: Vector<A>, a: A): Vector<A> {
62
- const suffixSize = getSuffixSize(as);
63
- if (suffixSize < 32) {
64
- return new Vector(
65
- incrementSuffix(as.bits),
66
- as.offset,
67
- as.length + 1,
68
- as.prefix,
69
- as.root,
70
- affixPush(a, as.suffix, suffixSize),
71
- );
72
- }
73
- const newSuffix = [a];
74
- const newVector = mutableClone(as);
75
- appendNodeToTree(newVector, as.suffix);
76
- newVector.suffix = newSuffix;
77
- newVector.length++;
78
- newVector.bits = setSuffix(1, newVector.bits);
79
- return newVector;
58
+ * @tsplus pipeable fncts.Vector append
59
+ * @tsplus pipeable-operator fncts.Vector +
60
+ */
61
+ export function append<A>(a: A) {
62
+ return (as: Vector<A>): Vector<A> => {
63
+ const suffixSize = getSuffixSize(as);
64
+ if (suffixSize < 32) {
65
+ return new Vector(
66
+ incrementSuffix(as.bits),
67
+ as.offset,
68
+ as.length + 1,
69
+ as.prefix,
70
+ as.root,
71
+ affixPush(a, as.suffix, suffixSize),
72
+ );
73
+ }
74
+ const newSuffix = [a];
75
+ const newVector = mutableClone(as);
76
+ appendNodeToTree(newVector, as.suffix);
77
+ newVector.suffix = newSuffix;
78
+ newVector.length++;
79
+ newVector.bits = setSuffix(1, newVector.bits);
80
+ return newVector;
81
+ };
80
82
  }
81
83
 
82
84
  /**
83
85
  * Maps a function over a Vector and concatenates all the resulting
84
86
  * Vectors together.
85
87
  *
86
- * @tsplus fluent fncts.Vector flatMap
88
+ * @tsplus pipeable fncts.Vector flatMap
87
89
  */
88
- export function flatMap_<A, B>(ma: Vector<A>, f: (a: A) => Vector<B>): Vector<B> {
89
- return ma.map(f).flatten;
90
+ export function flatMap<A, B>(f: (a: A) => Vector<B>) {
91
+ return (ma: Vector<A>): Vector<B> => {
92
+ return ma.map(f).flatten;
93
+ };
90
94
  }
91
95
 
92
96
  /**
93
97
  * Splits the Vector into chunks of the given size.
94
98
  *
95
- * @tsplus fluent fncts.Vector chunksOf
96
- */
97
- export function chunksOf_<A>(as: Vector<A>, size: number): Vector<Vector<A>> {
98
- const { buffer, l2 } = as.foldLeft(
99
- { l2: Vector.emptyPushable<Vector<A>>(), buffer: Vector.emptyPushable<A>() },
100
- ({ buffer, l2 }, elem) => {
101
- buffer.push(elem);
102
- if (buffer.length === size) {
103
- return { l2: l2.push(buffer), buffer: Vector.emptyPushable<A>() };
104
- } else {
105
- return { l2, buffer };
106
- }
107
- },
108
- );
109
- return buffer.length === 0 ? l2 : l2.push(buffer);
99
+ * @tsplus pipeable fncts.Vector chunksOf
100
+ */
101
+ export function chunksOf(size: number) {
102
+ return <A>(as: Vector<A>): Vector<Vector<A>> => {
103
+ const { buffer, l2 } = as.foldLeft(
104
+ { l2: Vector.emptyPushable<Vector<A>>(), buffer: Vector.emptyPushable<A>() },
105
+ ({ buffer, l2 }, elem) => {
106
+ buffer.push(elem);
107
+ if (buffer.length === size) {
108
+ return { l2: l2.push(buffer), buffer: Vector.emptyPushable<A>() };
109
+ } else {
110
+ return { l2, buffer };
111
+ }
112
+ },
113
+ );
114
+ return buffer.length === 0 ? l2 : l2.push(buffer);
115
+ };
110
116
  }
111
117
 
112
118
  /**
113
119
  * Concatenates two Vectors.
114
120
  *
115
121
  * @complexity O(log(n))
116
- * @tsplus fluent fncts.Vector concat
117
- * @tsplus operator fncts.Vector + 1
118
- */
119
- export function concat_<A, B>(self: Vector<A>, that: Vector<B>): Vector<A | B>;
120
- export function concat_<A>(self: Vector<A>, that: Vector<A>): Vector<A> {
121
- if (self.length === 0) {
122
- return that;
123
- } else if (that.length === 0) {
124
- return self;
125
- }
126
- const newSize = self.length + that.length;
127
- const rightSuffixSize = getSuffixSize(that);
128
- let newVector = self.mutableClone;
129
- if (that.root === undefined) {
130
- // right is nothing but a prefix and a suffix
131
- const nrOfAffixes = concatAffixes(self, that);
132
- for (let i = 0; i < nrOfAffixes; ++i) {
133
- newVector = appendNodeToTree(newVector, concatBuffer[i]);
134
- newVector.length += concatBuffer[i].length;
135
- // wipe pointer, otherwise it might end up keeping the array alive
136
- concatBuffer[i] = undefined;
122
+ * @tsplus pipeable fncts.Vector concat
123
+ * @tsplus pipeable-operator fncts.Vector + 1
124
+ */
125
+ export function concat<B>(that: Vector<B>): <A>(self: Vector<A>) => Vector<A | B>;
126
+ export function concat<A>(that: Vector<A>) {
127
+ return (self: Vector<A>): Vector<A> => {
128
+ if (self.length === 0) {
129
+ return that;
130
+ } else if (that.length === 0) {
131
+ return self;
137
132
  }
138
- newVector.length = newSize;
139
- newVector.suffix = concatBuffer[nrOfAffixes];
140
- newVector.bits = setSuffix(concatBuffer[nrOfAffixes].length, newVector.bits);
141
- concatBuffer[nrOfAffixes] = undefined;
142
- return newVector;
143
- } else {
144
- const leftSuffixSize = getSuffixSize(self);
145
- if (leftSuffixSize > 0) {
146
- newVector = appendNodeToTree(newVector, self.suffix.slice(0, leftSuffixSize));
147
- newVector.length += leftSuffixSize;
133
+ const newSize = self.length + that.length;
134
+ const rightSuffixSize = getSuffixSize(that);
135
+ let newVector = self.mutableClone;
136
+ if (that.root === undefined) {
137
+ // right is nothing but a prefix and a suffix
138
+ const nrOfAffixes = concatAffixes(self, that);
139
+ for (let i = 0; i < nrOfAffixes; ++i) {
140
+ newVector = appendNodeToTree(newVector, concatBuffer[i]);
141
+ newVector.length += concatBuffer[i].length;
142
+ // wipe pointer, otherwise it might end up keeping the array alive
143
+ concatBuffer[i] = undefined;
144
+ }
145
+ newVector.length = newSize;
146
+ newVector.suffix = concatBuffer[nrOfAffixes];
147
+ newVector.bits = setSuffix(concatBuffer[nrOfAffixes].length, newVector.bits);
148
+ concatBuffer[nrOfAffixes] = undefined;
149
+ return newVector;
150
+ } else {
151
+ const leftSuffixSize = getSuffixSize(self);
152
+ if (leftSuffixSize > 0) {
153
+ newVector = appendNodeToTree(newVector, self.suffix.slice(0, leftSuffixSize));
154
+ newVector.length += leftSuffixSize;
155
+ }
156
+ newVector = appendNodeToTree(newVector, that.prefix.slice(0, getPrefixSize(that)).reverse());
157
+ const newNode = concatSubTree(newVector.root!, getDepth(newVector), that.root, getDepth(that), true);
158
+ const newDepth = getHeight(newNode);
159
+ setSizes(newNode, newDepth);
160
+ newVector.root = newNode;
161
+ newVector.offset &= ~(mask << (getDepth(self) * branchBits));
162
+ newVector.length = newSize;
163
+ newVector.bits = setSuffix(rightSuffixSize, setDepth(newDepth, newVector.bits));
164
+ newVector.suffix = that.suffix;
165
+ return newVector;
148
166
  }
149
- newVector = appendNodeToTree(newVector, that.prefix.slice(0, getPrefixSize(that)).reverse());
150
- const newNode = concatSubTree(newVector.root!, getDepth(newVector), that.root, getDepth(that), true);
151
- const newDepth = getHeight(newNode);
152
- setSizes(newNode, newDepth);
153
- newVector.root = newNode;
154
- newVector.offset &= ~(mask << (getDepth(self) * branchBits));
155
- newVector.length = newSize;
156
- newVector.bits = setSuffix(rightSuffixSize, setDepth(newDepth, newVector.bits));
157
- newVector.suffix = that.suffix;
158
- return newVector;
159
- }
167
+ };
160
168
  }
161
169
 
162
170
  type ContainsState = {
@@ -178,32 +186,38 @@ function containsCb(value: any, state: ContainsState): boolean {
178
186
  * Otherwise it returns `false`.
179
187
  *
180
188
  * @complexity O(n)
181
- * @tsplus fluent fncts.Vector contains
189
+ * @tsplus pipeable fncts.Vector contains
182
190
  */
183
- export function contains_<A>(as: Vector<A>, element: A): boolean {
184
- containsState.element = element;
185
- containsState.result = false;
186
- return foldLeftCb(containsCb, containsState, as).result;
191
+ export function contains<A>(element: A) {
192
+ return (as: Vector<A>): boolean => {
193
+ containsState.element = element;
194
+ containsState.result = false;
195
+ return foldLeftCb(containsCb, containsState, as).result;
196
+ };
187
197
  }
188
198
 
189
199
  /**
190
200
  * Returns a new Vector without the first `n` elements.
191
201
  *
192
202
  * @complexity `O(log(n))`
193
- * @tsplus fluent fncts.Vector drop
203
+ * @tsplus pipeable fncts.Vector drop
194
204
  */
195
- export function drop_<A>(as: Vector<A>, n: number): Vector<A> {
196
- return as.slice(n, as.length);
205
+ export function drop(n: number) {
206
+ return <A>(as: Vector<A>): Vector<A> => {
207
+ return as.slice(n, as.length);
208
+ };
197
209
  }
198
210
 
199
211
  /**
200
212
  * Returns a new Vector without the last `n` elements.
201
213
  *
202
214
  * @complexity `O(log(n))`
203
- * @tsplus fluent fncts.Vector dropLast
215
+ * @tsplus pipeable fncts.Vector dropLast
204
216
  */
205
- export function dropLast_<A>(as: Vector<A>, n: number): Vector<A> {
206
- return as.slice(0, as.length - n);
217
+ export function dropLast(n: number) {
218
+ return <A>(as: Vector<A>): Vector<A> => {
219
+ return as.slice(0, as.length - n);
220
+ };
207
221
  }
208
222
 
209
223
  /**
@@ -221,12 +235,14 @@ export function dropRepeats<A>(as: Vector<A>): Vector<A> {
221
235
  * function to determine when elements are equal.
222
236
  *
223
237
  * @complexity `O(n)`
224
- * @tsplus fluent fncts.Vector dropRepeatsWith
238
+ * @tsplus pipeable fncts.Vector dropRepeatsWith
225
239
  */
226
- export function dropRepeatsWith_<A>(as: Vector<A>, predicate: (a: A, b: A) => boolean): Vector<A> {
227
- return as.foldLeft(Vector.emptyPushable(), (acc, a) =>
228
- acc.length !== 0 && predicate((acc as Vector<A>).unsafeLast!, a) ? acc : acc.push(a),
229
- );
240
+ export function dropRepeatsWith<A>(predicate: (a: A, b: A) => boolean) {
241
+ return (as: Vector<A>): Vector<A> => {
242
+ return as.foldLeft(Vector.emptyPushable(), (acc, a) =>
243
+ acc.length !== 0 && predicate((acc as Vector<A>).unsafeLast!, a) ? acc : acc.push(a),
244
+ );
245
+ };
230
246
  }
231
247
 
232
248
  type FindNotIndexState = {
@@ -249,11 +265,13 @@ function findNotIndexCb(value: any, state: FindNotIndexState): boolean {
249
265
  *
250
266
  * @complexity `O(k + log(n))` where `k` is the number of elements
251
267
  * satisfying the predicate.
252
- * @tsplus fluent fncts.Vector dropWhile
268
+ * @tsplus pipeable fncts.Vector dropWhile
253
269
  */
254
- export function dropWhile_<A>(as: Vector<A>, predicate: Predicate<A>): Vector<A> {
255
- const { index } = foldLeftCb(findNotIndexCb, { predicate, index: 0 }, as);
256
- return as.slice(index, as.length);
270
+ export function dropWhile<A>(predicate: Predicate<A>) {
271
+ return (as: Vector<A>): Vector<A> => {
272
+ const { index } = foldLeftCb(findNotIndexCb, { predicate, index: 0 }, as);
273
+ return as.slice(index, as.length);
274
+ };
257
275
  }
258
276
 
259
277
  type ElemState = {
@@ -267,26 +285,25 @@ function elemCb(value: any, state: ElemState): boolean {
267
285
  }
268
286
 
269
287
  /**
270
- * @tsplus getter fncts.Vector elem
288
+ * @tsplus pipeable fncts.Vector elem
271
289
  */
272
- export function elem_<A>(self: Vector<A>) {
273
- return (E: Eq<A>) => {
274
- const elemState: ElemState = { equals: E.equals, element: undefined, result: false };
275
- return (a: A): boolean => {
276
- elemState.element = a;
277
- return foldLeftCb(elemCb, elemState, self).result;
278
- };
290
+ export function elem<A>(a: A, /** @tsplus auto */ E: Eq<A>) {
291
+ const elemState: ElemState = { equals: E.equals, element: undefined, result: false };
292
+ return (self: Vector<A>): boolean => {
293
+ elemState.element = a;
294
+ return foldLeftCb(elemCb, elemState, self).result;
279
295
  };
280
296
  }
281
-
282
297
  /**
283
298
  * Returns true if the two Vectors are equivalent.
284
299
  *
285
300
  * @complexity O(n)
286
- * @tsplus fluent fncts.Vector equals
301
+ * @tsplus pipeable fncts.Vector equals
287
302
  */
288
- export function equals_<A>(self: Vector<A>, that: Vector<A>): boolean {
289
- return self.corresponds(that, Equatable.strictEquals);
303
+ export function equals<A>(that: Vector<A>) {
304
+ return (self: Vector<A>): boolean => {
305
+ return self.corresponds(that, Equatable.strictEquals);
306
+ };
290
307
  }
291
308
 
292
309
  type PredState = {
@@ -303,12 +320,14 @@ function everyCb<A>(value: A, state: any): boolean {
303
320
  * for all elements in the given Vector.
304
321
  *
305
322
  * @complexity O(n)
306
- * @tsplus fluent fncts.Vector every
323
+ * @tsplus pipeable fncts.Vector every
307
324
  */
308
- export function every_<A, B extends A>(as: Vector<A>, refinement: Refinement<A, B>): as is Vector<B>;
309
- export function every_<A>(as: Vector<A>, predicate: Predicate<A>): boolean;
310
- export function every_<A>(as: Vector<A>, predicate: Predicate<A>): boolean {
311
- return foldLeftCb<A, PredState>(everyCb, { predicate, result: true }, as).result;
325
+ export function every<A, B extends A>(refinement: Refinement<A, B>): (as: Vector<A>) => as is Vector<B>;
326
+ export function every<A>(predicate: Predicate<A>): (as: Vector<A>) => boolean;
327
+ export function every<A>(predicate: Predicate<A>) {
328
+ return (as: Vector<A>): boolean => {
329
+ return foldLeftCb<A, PredState>(everyCb, { predicate, result: true }, as).result;
330
+ };
312
331
  }
313
332
 
314
333
  /**
@@ -338,10 +357,12 @@ function existsCb<A>(value: A, state: PredState): boolean {
338
357
  *
339
358
  * @complexity O(n)
340
359
  *
341
- * @tsplus fluent fncts.Vector exists
360
+ * @tsplus pipeable fncts.Vector exists
342
361
  */
343
- export function exists_<A>(as: Vector<A>, predicate: Predicate<A>): boolean {
344
- return foldLeftCb<A, PredState>(existsCb, { predicate, result: false }, as).result;
362
+ export function exists<A>(predicate: Predicate<A>) {
363
+ return (as: Vector<A>): boolean => {
364
+ return foldLeftCb<A, PredState>(existsCb, { predicate, result: false }, as).result;
365
+ };
345
366
  }
346
367
 
347
368
  /**
@@ -349,10 +370,12 @@ export function exists_<A>(as: Vector<A>, predicate: Predicate<A>): boolean {
349
370
  * If no such element is found the function returns `undefined`.
350
371
  *
351
372
  * @complexity O(n)
352
- * @tsplus fluent fncts.Vector find
373
+ * @tsplus pipeable fncts.Vector find
353
374
  */
354
- export function find_<A>(as: Vector<A>, predicate: Predicate<A>): Maybe<A> {
355
- return Maybe.fromNullable(as.unsafeFind(predicate));
375
+ export function find<A>(predicate: Predicate<A>) {
376
+ return (as: Vector<A>): Maybe<A> => {
377
+ return Maybe.fromNullable(as.unsafeFind(predicate));
378
+ };
356
379
  }
357
380
 
358
381
  type FindIndexState = {
@@ -372,11 +395,13 @@ function findIndexCb<A>(value: A, state: FindIndexState): boolean {
372
395
  * `-1`.
373
396
  *
374
397
  * @complexity O(n)
375
- * @tsplus fluent fncts.Vector findIndex
398
+ * @tsplus pipeable fncts.Vector findIndex
376
399
  */
377
- export function findIndex_<A>(as: Vector<A>, predicate: Predicate<A>): number {
378
- const { found, index } = foldLeftCb<A, FindIndexState>(findIndexCb, { predicate, found: false, index: -1 }, as);
379
- return found ? index : -1;
400
+ export function findIndex<A>(predicate: Predicate<A>) {
401
+ return (as: Vector<A>): number => {
402
+ const { found, index } = foldLeftCb<A, FindIndexState>(findIndexCb, { predicate, found: false, index: -1 }, as);
403
+ return found ? index : -1;
404
+ };
380
405
  }
381
406
 
382
407
  /**
@@ -384,10 +409,12 @@ export function findIndex_<A>(as: Vector<A>, predicate: Predicate<A>): number {
384
409
  * If no such element is found the function returns `undefined`.
385
410
  *
386
411
  * @complexity O(n)
387
- * @tsplus fluent fncts.Vector findLast
412
+ * @tsplus pipeable fncts.Vector findLast
388
413
  */
389
- export function findLast_<A>(as: Vector<A>, predicate: Predicate<A>): Maybe<A> {
390
- return Maybe.fromNullable(as.unsafeFindLast(predicate));
414
+ export function findLast<A>(predicate: Predicate<A>) {
415
+ return (as: Vector<A>): Maybe<A> => {
416
+ return Maybe.fromNullable(as.unsafeFindLast(predicate));
417
+ };
391
418
  }
392
419
 
393
420
  /**
@@ -396,11 +423,13 @@ export function findLast_<A>(as: Vector<A>, predicate: Predicate<A>): Maybe<A> {
396
423
  * `-1`.
397
424
  *
398
425
  * @complexity O(n)
399
- * @tsplus fluent fncts.Vector findLastIndex
426
+ * @tsplus pipeable fncts.Vector findLastIndex
400
427
  */
401
- export function findLastIndex_<A>(as: Vector<A>, predicate: Predicate<A>): number {
402
- const { found, index } = foldRightCb<A, FindIndexState>(findIndexCb, { predicate, found: false, index: -0 }, as);
403
- return found ? index : -1;
428
+ export function findLastIndex<A>(predicate: Predicate<A>) {
429
+ return (as: Vector<A>): number => {
430
+ const { found, index } = foldRightCb<A, FindIndexState>(findIndexCb, { predicate, found: false, index: -0 }, as);
431
+ return found ? index : -1;
432
+ };
404
433
  }
405
434
 
406
435
  /**
@@ -441,23 +470,27 @@ export function from<A>(sequence: any): Vector<A> {
441
470
  /**
442
471
  * Folds a function over a Vector. Left-associative.
443
472
  *
444
- * @tsplus fluent fncts.Vector foldLeft
473
+ * @tsplus pipeable fncts.Vector foldLeft
445
474
  */
446
- export function foldLeft_<A, B>(fa: Vector<A>, initial: B, f: (acc: B, a: A) => B): B {
447
- return fa.foldLeftWithIndex(initial, (_, b, a) => f(b, a));
475
+ export function foldLeft<A, B>(initial: B, f: (acc: B, a: A) => B) {
476
+ return (fa: Vector<A>): B => {
477
+ return fa.foldLeftWithIndex(initial, (_, b, a) => f(b, a));
478
+ };
448
479
  }
449
480
 
450
481
  /**
451
- * @tsplus fluent fncts.Vector foldLeftWithIndex
482
+ * @tsplus pipeable fncts.Vector foldLeftWithIndex
452
483
  */
453
- export function foldLeftWithIndex_<A, B>(fa: Vector<A>, b: B, f: (i: number, b: B, a: A) => B): B {
454
- const suffixSize = getSuffixSize(fa);
455
- const prefixSize = getPrefixSize(fa);
456
- let [acc, index] = foldLeftPrefix(f, b, fa.prefix, prefixSize);
457
- if (fa.root !== undefined) {
458
- [acc, index] = foldLeftNode(f, acc, fa.root, getDepth(fa), index);
459
- }
460
- return foldLeftSuffix(f, acc, fa.suffix, suffixSize, index)[0];
484
+ export function foldLeftWithIndex<A, B>(b: B, f: (i: number, b: B, a: A) => B) {
485
+ return (fa: Vector<A>): B => {
486
+ const suffixSize = getSuffixSize(fa);
487
+ const prefixSize = getPrefixSize(fa);
488
+ let [acc, index] = foldLeftPrefix(f, b, fa.prefix, prefixSize);
489
+ if (fa.root !== undefined) {
490
+ [acc, index] = foldLeftNode(f, acc, fa.root, getDepth(fa), index);
491
+ }
492
+ return foldLeftSuffix(f, acc, fa.suffix, suffixSize, index)[0];
493
+ };
461
494
  }
462
495
 
463
496
  type FoldWhileState<A, B> = {
@@ -489,68 +522,76 @@ function foldWhileCb<A, B>(a: A, state: FoldWhileState<A, B>, i: number): boolea
489
522
  }
490
523
 
491
524
  /**
492
- * @tsplus fluent fncts.Vector foldLeftWhile
525
+ * @tsplus pipeable fncts.Vector foldLeftWhile
493
526
  */
494
- export function foldLeftWhile_<A, B>(fa: Vector<A>, b: B, cont: Predicate<B>, f: (i: number, b: B, a: A) => B): B {
495
- if (!cont(b)) {
496
- return b;
497
- }
498
- return foldLeftCb<A, FoldWhileState<A, B>>(foldWhileCb, { predicate: cont, f, result: b }, fa).result;
527
+ export function foldLeftWhile<A, B>(b: B, cont: Predicate<B>, f: (i: number, b: B, a: A) => B) {
528
+ return (fa: Vector<A>): B => {
529
+ if (!cont(b)) {
530
+ return b;
531
+ }
532
+ return foldLeftCb<A, FoldWhileState<A, B>>(foldWhileCb, { predicate: cont, f, result: b }, fa).result;
533
+ };
499
534
  }
500
535
 
501
536
  /**
502
- * @tsplus fluent fncts.Vector foldRightWhile
537
+ * @tsplus pipeable fncts.Vector foldRightWhile
503
538
  */
504
- export function foldRightWhile_<A, B>(fa: Vector<A>, b: B, cont: Predicate<B>, f: (i: number, a: A, b: B) => B): B {
505
- return foldRightCb<A, FoldWhileState<A, B>>(
506
- foldWhileCb,
507
- { predicate: cont, result: b, f: (i, b, a) => f(i, a, b) },
508
- fa,
509
- ).result;
539
+ export function foldRightWhile<A, B>(b: B, cont: Predicate<B>, f: (i: number, a: A, b: B) => B) {
540
+ return (fa: Vector<A>): B => {
541
+ return foldRightCb<A, FoldWhileState<A, B>>(
542
+ foldWhileCb,
543
+ { predicate: cont, result: b, f: (i, b, a) => f(i, a, b) },
544
+ fa,
545
+ ).result;
546
+ };
510
547
  }
511
548
 
512
549
  /**
513
- * @tsplus fluent fncts.Vector foldMap
550
+ * @tsplus pipeable fncts.Vector foldMap
514
551
  */
515
- export function foldMap_<A, M>(self: Vector<A>, f: (a: A) => M, /** @tsplus auto */ M: Monoid<M>): M {
516
- return self.foldMapWithIndex((_, a) => f(a), M);
552
+ export function foldMap<A, M>(f: (a: A) => M, /** @tsplus auto */ M: Monoid<M>) {
553
+ return (self: Vector<A>): M => {
554
+ return self.foldMapWithIndex((_, a) => f(a), M);
555
+ };
517
556
  }
518
557
 
519
558
  /**
520
- * @tsplus fluent fncts.Vector foldMapWithIndex
559
+ * @tsplus pipeable fncts.Vector foldMapWithIndex
521
560
  */
522
- export function foldMapWithIndex_<A, M>(
523
- self: Vector<A>,
524
- f: (i: number, a: A) => M,
525
- /** @tsplus auto */ M: Monoid<M>,
526
- ): M {
527
- return self.foldLeftWithIndex(M.nat, (i, b, a) => M.combine(b, f(i, a)));
561
+ export function foldMapWithIndex<A, M>(f: (i: number, a: A) => M, /** @tsplus auto */ M: Monoid<M>) {
562
+ return (self: Vector<A>): M => {
563
+ return self.foldLeftWithIndex(M.nat, (i, b, a) => M.combine(b, f(i, a)));
564
+ };
528
565
  }
529
566
 
530
567
  /**
531
568
  * Folds a function over a Vector. Right-associative.
532
569
  *
533
570
  * @complexity O(n)
534
- * @tsplus fluent fncts.Vector foldRight
571
+ * @tsplus pipeable fncts.Vector foldRight
535
572
  */
536
- export function foldRight_<A, B>(fa: Vector<A>, initial: B, f: (value: A, acc: B) => B): B {
537
- return fa.foldRightWithIndex(initial, (_, a, b) => f(a, b));
573
+ export function foldRight<A, B>(initial: B, f: (value: A, acc: B) => B) {
574
+ return (fa: Vector<A>): B => {
575
+ return fa.foldRightWithIndex(initial, (_, a, b) => f(a, b));
576
+ };
538
577
  }
539
578
 
540
579
  /**
541
580
  * Folds a function over a Vector. Right-associative.
542
581
  *
543
582
  * @complexity O(n)
544
- * @tsplus fluent fncts.Vector foldRightWithIndex
545
- */
546
- export function foldRightWithIndex_<A, B>(fa: Vector<A>, b: B, f: (i: number, a: A, b: B) => B): B {
547
- const suffixSize = getSuffixSize(fa);
548
- const prefixSize = getPrefixSize(fa);
549
- let [acc, j] = foldRightSuffix(f, b, fa.suffix, suffixSize, fa.length - 1);
550
- if (fa.root !== undefined) {
551
- [acc, j] = foldRightNode(f, acc, fa.root, getDepth(fa), j);
552
- }
553
- return foldRightPrefix(f, acc, fa.prefix, prefixSize, j)[0];
583
+ * @tsplus pipeable fncts.Vector foldRightWithIndex
584
+ */
585
+ export function foldRightWithIndex<A, B>(b: B, f: (i: number, a: A, b: B) => B) {
586
+ return (fa: Vector<A>): B => {
587
+ const suffixSize = getSuffixSize(fa);
588
+ const prefixSize = getPrefixSize(fa);
589
+ let [acc, j] = foldRightSuffix(f, b, fa.suffix, suffixSize, fa.length - 1);
590
+ if (fa.root !== undefined) {
591
+ [acc, j] = foldRightNode(f, acc, fa.root, getDepth(fa), j);
592
+ }
593
+ return foldRightPrefix(f, acc, fa.prefix, prefixSize, j)[0];
594
+ };
554
595
  }
555
596
 
556
597
  /**
@@ -563,17 +604,21 @@ export function foldRightWithIndex_<A, B>(fa: Vector<A>, b: B, f: (i: number, a:
563
604
  * makes `forEach` faster when the new Vector is unneeded.
564
605
  *
565
606
  * @complexity O(n)
566
- * @tsplus fluent fncts.Vector forEach
607
+ * @tsplus pipeable fncts.Vector forEach
567
608
  */
568
- export function forEach_<A>(as: Vector<A>, f: (a: A) => void): void {
569
- as.foldLeft(undefined as void, (_, element) => f(element));
609
+ export function forEach<A>(f: (a: A) => void) {
610
+ return (as: Vector<A>): void => {
611
+ as.foldLeft(undefined as void, (_, element) => f(element));
612
+ };
570
613
  }
571
614
 
572
615
  /**
573
- * @tsplus fluent fncts.Vector forEachWithIndex
616
+ * @tsplus pipeable fncts.Vector forEachWithIndex
574
617
  */
575
- export function forEachWithIndex_<A>(as: Vector<A>, f: (i: number, a: A) => void): void {
576
- as.foldLeftWithIndex(undefined as void, (index, _, element) => f(index, element));
618
+ export function forEachWithIndex<A>(f: (i: number, a: A) => void) {
619
+ return (as: Vector<A>): void => {
620
+ as.foldLeftWithIndex(undefined as void, (index, _, element) => f(index, element));
621
+ };
577
622
  }
578
623
 
579
624
  /**
@@ -581,10 +626,12 @@ export function forEachWithIndex_<A>(as: Vector<A>, f: (i: number, a: A) => void
581
626
  * `undefined` is returned.
582
627
  *
583
628
  * @complexity O(log(n))
584
- * @tsplus fluent fncts.Vector get
629
+ * @tsplus pipeable fncts.Vector get
585
630
  */
586
- export function get_<A>(self: Vector<A>, index: number): Maybe<A> {
587
- return Maybe.fromNullable(self.unsafeGet(index));
631
+ export function get(index: number) {
632
+ return <A>(self: Vector<A>): Maybe<A> => {
633
+ return Maybe.fromNullable(self.unsafeGet(index));
634
+ };
588
635
  }
589
636
 
590
637
  /**
@@ -595,19 +642,21 @@ export function get_<A>(self: Vector<A>, index: number): Maybe<A> {
595
642
  * equal elements should be grouped together the Vector should be sorted
596
643
  * before grouping.
597
644
  *
598
- * @tsplus fluent fncts.Vector groupWith
645
+ * @tsplus pipeable fncts.Vector groupWith
599
646
  */
600
- export function groupWith_<A>(as: Vector<A>, f: (a: A, b: A) => boolean): Vector<Vector<A>> {
601
- const result = Vector.emptyPushable<MutableVector<A>>();
602
- let buffer = Vector.emptyPushable<A>();
603
- forEach_(as, (a) => {
604
- if (buffer.length !== 0 && !f(unsafeLast(buffer)!, a)) {
605
- result.push(buffer);
606
- buffer = emptyPushable();
607
- }
608
- buffer.push(a);
609
- });
610
- return buffer.length === 0 ? result : result.push(buffer);
647
+ export function groupWith<A>(f: (a: A, b: A) => boolean) {
648
+ return (as: Vector<A>): Vector<Vector<A>> => {
649
+ const result = Vector.emptyPushable<MutableVector<A>>();
650
+ let buffer = Vector.emptyPushable<A>();
651
+ as.forEach((a) => {
652
+ if (buffer.length !== 0 && !f(unsafeLast(buffer)!, a)) {
653
+ result.push(buffer);
654
+ buffer = emptyPushable();
655
+ }
656
+ buffer.push(a);
657
+ });
658
+ return buffer.length === 0 ? result : result.push(buffer);
659
+ };
611
660
  }
612
661
 
613
662
  /**
@@ -636,41 +685,49 @@ function indexOfCb(value: any, state: IndexOfState): boolean {
636
685
  * to the given element. If no such element is found `-1` is returned.
637
686
  *
638
687
  * @complexity O(n)
639
- * @tsplus fluent fncts.Vector indexOf
688
+ * @tsplus pipeable fncts.Vector indexOf
640
689
  */
641
- export function indexOf_<A>(as: Vector<A>, element: A): number {
642
- const state = { element, found: false, index: -1 };
643
- foldLeftCb(indexOfCb, state, as);
644
- return state.found ? state.index : -1;
690
+ export function indexOf<A>(element: A) {
691
+ return (as: Vector<A>): number => {
692
+ const state = { element, found: false, index: -1 };
693
+ foldLeftCb(indexOfCb, state, as);
694
+ return state.found ? state.index : -1;
695
+ };
645
696
  }
646
697
 
647
698
  /**
648
699
  * Inserts the given element at the given index in the Vector.
649
700
  *
650
701
  * @complexity O(log(n))
651
- * @tsplus fluent fncts.Vector insertAt
702
+ * @tsplus pipeable fncts.Vector insertAt
652
703
  */
653
- export function insertAt_<A>(as: Vector<A>, index: number, element: A): Vector<A> {
654
- return as.slice(0, index).append(element).concat(as.slice(index, as.length));
704
+ export function insertAt<A>(index: number, element: A) {
705
+ return (as: Vector<A>): Vector<A> => {
706
+ return as.slice(0, index).append(element).concat(as.slice(index, as.length));
707
+ };
655
708
  }
656
709
 
657
710
  /**
658
711
  * Inserts the given Vector of elements at the given index in the Vector.
659
712
  *
660
713
  * @complexity `O(log(n))`
661
- * @tsplus fluent fncts.Vector insertAllAt
714
+ * @tsplus pipeable fncts.Vector insertAllAt
662
715
  */
663
- export function insertAllAt_<A>(as: Vector<A>, index: number, elements: Vector<A>): Vector<A> {
664
- return as.slice(0, index).concat(elements).concat(as.slice(index, as.length));
716
+ export function insertAllAt<A>(index: number, elements: Vector<A>) {
717
+ return (as: Vector<A>): Vector<A> => {
718
+ return as.slice(0, index).concat(elements).concat(as.slice(index, as.length));
719
+ };
665
720
  }
666
721
 
667
722
  /**
668
723
  * Inserts a separator between each element in a Vector.
669
724
  *
670
- * @tsplus fluent fncts.Vector intersperse
725
+ * @tsplus pipeable fncts.Vector intersperse
671
726
  */
672
- export function intersperse_<A>(as: Vector<A>, separator: A): Vector<A> {
673
- return (as.foldLeft(Vector.emptyPushable(), (l2, a) => l2.push(a).push(separator)) as Vector<A>).pop;
727
+ export function intersperse<A>(separator: A) {
728
+ return (as: Vector<A>): Vector<A> => {
729
+ return (as.foldLeft(Vector.emptyPushable(), (l2, a) => l2.push(a).push(separator)) as Vector<A>).pop;
730
+ };
674
731
  }
675
732
 
676
733
  /**
@@ -690,10 +747,12 @@ export function isNonEmpty<A>(l: Vector<A>): boolean {
690
747
  /**
691
748
  * Concatenates the strings in the Vector separated by a specified separator.
692
749
  *
693
- * @tsplus fluent fncts.Vector join
750
+ * @tsplus pipeable fncts.Vector join
694
751
  */
695
- export function join_(as: Vector<string>, separator: string): string {
696
- return as.foldLeft("", (a, b) => (a.length === 0 ? b : a + separator + b));
752
+ export function join(separator: string) {
753
+ return (as: Vector<string>): string => {
754
+ return as.foldLeft("", (a, b) => (a.length === 0 ? b : a + separator + b));
755
+ };
697
756
  }
698
757
 
699
758
  /**
@@ -711,12 +770,14 @@ export function last<A>(l: Vector<A>): Maybe<NonNullable<A>> {
711
770
  * to the given element. If no such element is found `-1` is returned.
712
771
  *
713
772
  * @complexity O(n)
714
- * @tsplus fluent fncts.Vector lastIndexOf
773
+ * @tsplus pipeable fncts.Vector lastIndexOf
715
774
  */
716
- export function lastIndexOf_<A>(as: Vector<A>, element: A): number {
717
- const state = { element, found: false, index: 0 };
718
- foldRightCb(indexOfCb, state, as);
719
- return state.found ? as.length - state.index : -1;
775
+ export function lastIndexOf<A>(element: A) {
776
+ return (as: Vector<A>): number => {
777
+ const state = { element, found: false, index: 0 };
778
+ foldRightCb(indexOfCb, state, as);
779
+ return state.found ? as.length - state.index : -1;
780
+ };
720
781
  }
721
782
 
722
783
  /**
@@ -735,14 +796,16 @@ export function makeBy<A>(n: number, f: (index: number) => A): Vector<A> {
735
796
  }
736
797
 
737
798
  /**
738
- * @tsplus fluent fncts.Vector mapAccum
799
+ * @tsplus pipeable fncts.Vector mapAccum
739
800
  */
740
- export function mapAccum_<A, S, B>(fa: Vector<A>, s: S, f: (s: S, a: A) => readonly [B, S]): readonly [Vector<B>, S] {
741
- return fa.foldLeft([Vector.emptyPushable(), s], ([acc, s], a) => {
742
- const r = f(s, a);
743
- acc.push(r[0]);
744
- return [acc, r[1]];
745
- });
801
+ export function mapAccum<A, S, B>(s: S, f: (s: S, a: A) => readonly [B, S]) {
802
+ return (fa: Vector<A>): readonly [Vector<B>, S] => {
803
+ return fa.foldLeft([Vector.emptyPushable(), s], ([acc, s], a) => {
804
+ const r = f(s, a);
805
+ acc.push(r[0]);
806
+ return [acc, r[1]];
807
+ });
808
+ };
746
809
  }
747
810
 
748
811
  /**
@@ -750,10 +813,12 @@ export function mapAccum_<A, S, B>(fa: Vector<A>, s: S, f: (s: S, a: A) => reado
750
813
  * new Vector of the values that the function return.
751
814
  *
752
815
  * @complexity O(n)
753
- * @tsplus fluent fncts.Vector map
816
+ * @tsplus pipeable fncts.Vector map
754
817
  */
755
- export function map_<A, B>(fa: Vector<A>, f: (a: A) => B): Vector<B> {
756
- return fa.mapWithIndex((_, a) => f(a));
818
+ export function map<A, B>(f: (a: A) => B) {
819
+ return (fa: Vector<A>): Vector<B> => {
820
+ return fa.mapWithIndex((_, a) => f(a));
821
+ };
757
822
  }
758
823
 
759
824
  /**
@@ -761,17 +826,19 @@ export function map_<A, B>(fa: Vector<A>, f: (a: A) => B): Vector<B> {
761
826
  * new Vector of the values that the function return.
762
827
  *
763
828
  * @complexity O(n)
764
- * @tsplus fluent fncts.Vector mapWithIndex
829
+ * @tsplus pipeable fncts.Vector mapWithIndex
765
830
  */
766
- export function mapWithIndex_<A, B>(fa: Vector<A>, f: (i: number, a: A) => B): Vector<B> {
767
- return new Vector(
768
- fa.bits,
769
- fa.offset,
770
- fa.length,
771
- mapPrefix(f, fa.prefix, getPrefixSize(fa)),
772
- fa.root === undefined ? undefined : mapNode(f, fa.root, getDepth(fa), getPrefixSize(fa), 1)[0],
773
- mapAffix(f, fa.suffix, getSuffixSize(fa), fa.length),
774
- );
831
+ export function mapWithIndex<A, B>(f: (i: number, a: A) => B) {
832
+ return (fa: Vector<A>): Vector<B> => {
833
+ return new Vector(
834
+ fa.bits,
835
+ fa.offset,
836
+ fa.length,
837
+ mapPrefix(f, fa.prefix, getPrefixSize(fa)),
838
+ fa.root === undefined ? undefined : mapNode(f, fa.root, getDepth(fa), getPrefixSize(fa), 1)[0],
839
+ mapAffix(f, fa.suffix, getSuffixSize(fa), fa.length),
840
+ );
841
+ };
775
842
  }
776
843
 
777
844
  /**
@@ -790,13 +857,15 @@ export function mutableClone<A>(as: Vector<A>): MutableVector<A> {
790
857
  *
791
858
  * @complexity `O(log(n))`
792
859
  *
793
- * @tsplus fluent fncts.Vector modifyAt
860
+ * @tsplus pipeable fncts.Vector modifyAt
794
861
  */
795
- export function modifyAt_<A>(as: Vector<A>, i: number, f: (a: A) => A): Vector<A> {
796
- if (i < 0 || as.length <= i) {
797
- return as;
798
- }
799
- return as.updateAt(i, f(as.unsafeGet(i)!));
862
+ export function modifyAt<A>(i: number, f: (a: A) => A) {
863
+ return (as: Vector<A>): Vector<A> => {
864
+ if (i < 0 || as.length <= i) {
865
+ return as;
866
+ }
867
+ return as.updateAt(i, f(as.unsafeGet(i)!));
868
+ };
800
869
  }
801
870
 
802
871
  /**
@@ -805,10 +874,12 @@ export function modifyAt_<A>(as: Vector<A>, i: number, f: (a: A) => A): Vector<A
805
874
  *
806
875
  * @complexity O(n)
807
876
  *
808
- * @tsplus fluent fncts.Vector none
877
+ * @tsplus pipeable fncts.Vector none
809
878
  */
810
- export function none_<A>(as: Vector<A>, predicate: Predicate<A>): boolean {
811
- return !as.exists(predicate);
879
+ export function none<A>(predicate: Predicate<A>) {
880
+ return (as: Vector<A>): boolean => {
881
+ return !as.exists(predicate);
882
+ };
812
883
  }
813
884
 
814
885
  /**
@@ -837,28 +908,30 @@ export function pop<A>(as: Vector<A>): Vector<A> {
837
908
  *
838
909
  * @complexity O(1)
839
910
  *
840
- * @tsplus fluent fncts.Vector prepend
841
- */
842
- export function prepend_<A>(as: Vector<A>, a: A): Vector<A> {
843
- const prefixSize = getPrefixSize(as);
844
- if (prefixSize < 32) {
845
- return new Vector<A>(
846
- incrementPrefix(as.bits),
847
- as.offset,
848
- as.length + 1,
849
- affixPush(a, as.prefix, prefixSize),
850
- as.root,
851
- as.suffix,
852
- );
853
- } else {
854
- const newVector = mutableClone(as);
855
- prependNodeToTree(newVector, reverseArray(as.prefix));
856
- const newPrefix = [a];
857
- newVector.prefix = newPrefix;
858
- newVector.length++;
859
- newVector.bits = setPrefix(1, newVector.bits);
860
- return newVector;
861
- }
911
+ * @tsplus pipeable fncts.Vector prepend
912
+ */
913
+ export function prepend<A>(a: A) {
914
+ return (as: Vector<A>): Vector<A> => {
915
+ const prefixSize = getPrefixSize(as);
916
+ if (prefixSize < 32) {
917
+ return new Vector<A>(
918
+ incrementPrefix(as.bits),
919
+ as.offset,
920
+ as.length + 1,
921
+ affixPush(a, as.prefix, prefixSize),
922
+ as.root,
923
+ as.suffix,
924
+ );
925
+ } else {
926
+ const newVector = mutableClone(as);
927
+ prependNodeToTree(newVector, reverseArray(as.prefix));
928
+ const newPrefix = [a];
929
+ newVector.prefix = newPrefix;
930
+ newVector.length++;
931
+ newVector.bits = setPrefix(1, newVector.bits);
932
+ return newVector;
933
+ }
934
+ };
862
935
  }
863
936
 
864
937
  /**
@@ -889,10 +962,12 @@ export function range(start: number, end: number): Vector<number> {
889
962
  *
890
963
  * @complexity `O(log(n))`
891
964
  *
892
- * @tsplus fluent fncts.Vector remove
965
+ * @tsplus pipeable fncts.Vector remove
893
966
  */
894
- export function remove_<A>(as: Vector<A>, from: number, amount: number): Vector<A> {
895
- return as.slice(0, from).concat(as.slice(from + amount, as.length));
967
+ export function remove(from: number, amount: number) {
968
+ return <A>(as: Vector<A>): Vector<A> => {
969
+ return as.slice(0, from).concat(as.slice(from + amount, as.length));
970
+ };
896
971
  }
897
972
 
898
973
  /**
@@ -922,10 +997,12 @@ export function reverse<A>(self: Vector<A>): Vector<A> {
922
997
  * Folds a function over a Vector from left to right while collecting
923
998
  * all the intermediate steps in a resulting Vector.
924
999
  *
925
- * @tsplus fluent fncts.Vector scanLeft
1000
+ * @tsplus pipeable fncts.Vector scanLeft
926
1001
  */
927
- export function scanLeft_<A, B>(as: Vector<A>, initial: B, f: (acc: B, value: A) => B): Vector<B> {
928
- return as.foldLeft(emptyPushable<B>().push(initial), (l2, a) => l2.push(f((l2 as Vector<B>).unsafeLast!, a)));
1002
+ export function scanLeft<A, B>(initial: B, f: (acc: B, value: A) => B) {
1003
+ return (as: Vector<A>): Vector<B> => {
1004
+ return as.foldLeft(emptyPushable<B>().push(initial), (l2, a) => l2.push(f((l2 as Vector<B>).unsafeLast!, a)));
1005
+ };
929
1006
  }
930
1007
 
931
1008
  /**
@@ -944,123 +1021,119 @@ export function single<A>(a: A): Vector<A> {
944
1021
  * from the right end of the Vector.
945
1022
  *
946
1023
  * @complexity `O(log(n))`
947
- * @tsplus fluent fncts.Vector slice
948
- */
949
- export function slice_<A>(as: Vector<A>, from: number, to: number): Vector<A> {
950
- let { bits, length } = as;
951
- let _to = to;
952
- let _from = from;
953
- _to = Math.min(length, to);
954
- // Handle negative indices
955
- if (_from < 0) {
956
- _from = length + from;
957
- }
958
- if (_to < 0) {
959
- _to = length + to;
960
- }
961
-
962
- // Should we just return the empty Vector?
963
- if (_to <= _from || _to <= 0 || length <= _from) {
964
- return empty();
965
- }
966
-
967
- // Return Vector unchanged if we are slicing nothing off
968
- if (_from <= 0 && length <= _to) {
969
- return as;
970
- }
971
-
972
- const newLength = _to - _from;
973
- let prefixSize = getPrefixSize(as);
974
- const suffixSize = getSuffixSize(as);
975
-
976
- // Both indices lie in the prefix
977
- if (_to <= prefixSize) {
978
- return new Vector(
979
- setPrefix(newLength, 0),
980
- 0,
981
- newLength,
982
- as.prefix.slice(prefixSize - _to, prefixSize - _from),
983
- undefined,
984
- emptyAffix,
985
- );
986
- }
987
-
988
- const suffixStart = length - suffixSize;
989
- // Both indices lie in the suffix
990
- if (suffixStart <= _from) {
991
- return new Vector(
992
- setSuffix(newLength, 0),
993
- 0,
994
- newLength,
995
- emptyAffix,
996
- undefined,
997
- as.suffix.slice(_from - suffixStart, _to - suffixStart),
998
- );
999
- }
1000
-
1001
- const newVector = mutableClone(as);
1002
- newVector.length = newLength;
1003
-
1004
- // Both indices lie in the tree
1005
- if (prefixSize <= _from && _to <= suffixStart) {
1006
- sliceTreeVector(
1007
- _from - prefixSize + as.offset,
1008
- _to - prefixSize + as.offset - 1,
1009
- as.root!,
1010
- getDepth(as),
1011
- as.offset,
1012
- newVector,
1013
- );
1014
- return newVector;
1015
- }
1016
-
1017
- if (0 < _from) {
1018
- // we need _to slice something off of the left
1019
- if (_from < prefixSize) {
1020
- // shorten the prefix even though it's not strictly needed,
1021
- // so that referenced items can be GC'd
1022
- newVector.prefix = as.prefix.slice(0, prefixSize - _from);
1023
- bits = setPrefix(prefixSize - _from, bits);
1024
- } else {
1025
- // if we're here `_to` can't lie in the tree, so we can set the
1026
- // root
1027
- zeroOffset();
1028
- newVector.root = sliceLeft(newVector.root!, getDepth(as), _from - prefixSize, as.offset, true);
1029
- newVector.offset = newOffset;
1030
- if (newVector.root === undefined) {
1031
- bits = setDepth(0, bits);
1024
+ * @tsplus pipeable fncts.Vector slice
1025
+ */
1026
+ export function slice(from: number, to: number) {
1027
+ return <A>(as: Vector<A>): Vector<A> => {
1028
+ let { bits, length } = as;
1029
+ let _to = to;
1030
+ let _from = from;
1031
+ _to = Math.min(length, to);
1032
+ // Handle negative indices
1033
+ if (_from < 0) {
1034
+ _from = length + from;
1035
+ }
1036
+ if (_to < 0) {
1037
+ _to = length + to;
1038
+ }
1039
+ // Should we just return the empty Vector?
1040
+ if (_to <= _from || _to <= 0 || length <= _from) {
1041
+ return empty();
1042
+ }
1043
+ // Return Vector unchanged if we are slicing nothing off
1044
+ if (_from <= 0 && length <= _to) {
1045
+ return as;
1046
+ }
1047
+ const newLength = _to - _from;
1048
+ let prefixSize = getPrefixSize(as);
1049
+ const suffixSize = getSuffixSize(as);
1050
+ // Both indices lie in the prefix
1051
+ if (_to <= prefixSize) {
1052
+ return new Vector(
1053
+ setPrefix(newLength, 0),
1054
+ 0,
1055
+ newLength,
1056
+ as.prefix.slice(prefixSize - _to, prefixSize - _from),
1057
+ undefined,
1058
+ emptyAffix,
1059
+ );
1060
+ }
1061
+ const suffixStart = length - suffixSize;
1062
+ // Both indices lie in the suffix
1063
+ if (suffixStart <= _from) {
1064
+ return new Vector(
1065
+ setSuffix(newLength, 0),
1066
+ 0,
1067
+ newLength,
1068
+ emptyAffix,
1069
+ undefined,
1070
+ as.suffix.slice(_from - suffixStart, _to - suffixStart),
1071
+ );
1072
+ }
1073
+ const newVector = mutableClone(as);
1074
+ newVector.length = newLength;
1075
+ // Both indices lie in the tree
1076
+ if (prefixSize <= _from && _to <= suffixStart) {
1077
+ sliceTreeVector(
1078
+ _from - prefixSize + as.offset,
1079
+ _to - prefixSize + as.offset - 1,
1080
+ as.root!,
1081
+ getDepth(as),
1082
+ as.offset,
1083
+ newVector,
1084
+ );
1085
+ return newVector;
1086
+ }
1087
+ if (0 < _from) {
1088
+ // we need _to slice something off of the left
1089
+ if (_from < prefixSize) {
1090
+ // shorten the prefix even though it's not strictly needed,
1091
+ // so that referenced items can be GC'd
1092
+ newVector.prefix = as.prefix.slice(0, prefixSize - _from);
1093
+ bits = setPrefix(prefixSize - _from, bits);
1094
+ } else {
1095
+ // if we're here `_to` can't lie in the tree, so we can set the
1096
+ // root
1097
+ zeroOffset();
1098
+ newVector.root = sliceLeft(newVector.root!, getDepth(as), _from - prefixSize, as.offset, true);
1099
+ newVector.offset = newOffset;
1100
+ if (newVector.root === undefined) {
1101
+ bits = setDepth(0, bits);
1102
+ }
1103
+ bits = setPrefix(newAffix.length, bits);
1104
+ prefixSize = newAffix.length;
1105
+ newVector.prefix = newAffix;
1032
1106
  }
1033
- bits = setPrefix(newAffix.length, bits);
1034
- prefixSize = newAffix.length;
1035
- newVector.prefix = newAffix;
1036
1107
  }
1037
- }
1038
- if (_to < length) {
1039
- // we need _to slice something off of the right
1040
- if (length - _to < suffixSize) {
1041
- bits = setSuffix(suffixSize - (length - _to), bits);
1042
- // slice the suffix even though it's not strictly needed,
1043
- // _to allow the removed items _to be GC'd
1044
- newVector.suffix = as.suffix.slice(0, suffixSize - (length - _to));
1045
- } else {
1046
- newVector.root = sliceRight(newVector.root!, getDepth(as), _to - prefixSize - 1, newVector.offset);
1047
- if (newVector.root === undefined) {
1048
- bits = setDepth(0, bits);
1049
- newVector.offset = 0;
1108
+ if (_to < length) {
1109
+ // we need _to slice something off of the right
1110
+ if (length - _to < suffixSize) {
1111
+ bits = setSuffix(suffixSize - (length - _to), bits);
1112
+ // slice the suffix even though it's not strictly needed,
1113
+ // _to allow the removed items _to be GC'd
1114
+ newVector.suffix = as.suffix.slice(0, suffixSize - (length - _to));
1115
+ } else {
1116
+ newVector.root = sliceRight(newVector.root!, getDepth(as), _to - prefixSize - 1, newVector.offset);
1117
+ if (newVector.root === undefined) {
1118
+ bits = setDepth(0, bits);
1119
+ newVector.offset = 0;
1120
+ }
1121
+ bits = setSuffix(newAffix.length, bits);
1122
+ newVector.suffix = newAffix;
1050
1123
  }
1051
- bits = setSuffix(newAffix.length, bits);
1052
- newVector.suffix = newAffix;
1053
1124
  }
1054
- }
1055
- newVector.bits = bits;
1056
- return newVector;
1125
+ newVector.bits = bits;
1126
+ return newVector;
1127
+ };
1057
1128
  }
1058
1129
 
1059
1130
  /**
1060
- * @tsplus fluent fncts.Vector sort
1131
+ * @tsplus pipeable fncts.Vector sort
1061
1132
  */
1062
- export function sort_<A>(self: Vector<A>, /** @tsplus auto */ O: Ord<A>): Vector<A> {
1063
- return self.sortWith(O.compare);
1133
+ export function sort<A>(/** @tsplus auto */ O: Ord<A>) {
1134
+ return (self: Vector<A>): Vector<A> => {
1135
+ return self.sortWith(O.compare);
1136
+ };
1064
1137
  }
1065
1138
 
1066
1139
  /**
@@ -1072,21 +1145,26 @@ export function sort_<A>(self: Vector<A>, /** @tsplus auto */ O: Ord<A>): Vector
1072
1145
  *
1073
1146
  * @complexity O(n * log(n))
1074
1147
  *
1075
- * @tsplus fluent fncts.Vector sortWith
1076
- */
1077
- export function sortWith_<A>(as: Vector<A>, compare: (a: A, b: A) => Ordering): Vector<A> {
1078
- const arr: { idx: number; elm: A }[] = [];
1079
- let i = 0;
1080
- as.forEach((elm) => arr.push({ idx: i++, elm }));
1081
- arr.sort(({ elm: a, idx: i }, { elm: b, idx: j }) => {
1082
- const c = compare(a, b);
1083
- return c !== 0 ? c : i < j ? -1 : 1;
1084
- });
1085
- const newL = emptyPushable<A>();
1086
- for (let i = 0; i < arr.length; ++i) {
1087
- newL.push(arr[i]!.elm);
1088
- }
1089
- return newL;
1148
+ * @tsplus pipeable fncts.Vector sortWith
1149
+ */
1150
+ export function sortWith<A>(compare: (a: A, b: A) => Ordering) {
1151
+ return (as: Vector<A>): Vector<A> => {
1152
+ const arr: {
1153
+ idx: number;
1154
+ elm: A;
1155
+ }[] = [];
1156
+ let i = 0;
1157
+ as.forEach((elm) => arr.push({ idx: i++, elm }));
1158
+ arr.sort(({ elm: a, idx: i }, { elm: b, idx: j }) => {
1159
+ const c = compare(a, b);
1160
+ return c !== 0 ? c : i < j ? -1 : 1;
1161
+ });
1162
+ const newL = emptyPushable<A>();
1163
+ for (let i = 0; i < arr.length; ++i) {
1164
+ newL.push(arr[i]!.elm);
1165
+ }
1166
+ return newL;
1167
+ };
1090
1168
  }
1091
1169
 
1092
1170
  /**
@@ -1097,10 +1175,12 @@ export function sortWith_<A>(as: Vector<A>, compare: (a: A, b: A) => Ordering):
1097
1175
  *
1098
1176
  * @complexity `O(log(n))`
1099
1177
  *
1100
- * @tsplus fluent fncts.Vector splitAt
1178
+ * @tsplus pipeable fncts.Vector splitAt
1101
1179
  */
1102
- export function splitAt_<A>(as: Vector<A>, index: number): [Vector<A>, Vector<A>] {
1103
- return [as.slice(0, index), as.slice(index, as.length)];
1180
+ export function splitAt(index: number) {
1181
+ return <A>(as: Vector<A>): [Vector<A>, Vector<A>] => {
1182
+ return [as.slice(0, index), as.slice(index, as.length)];
1183
+ };
1104
1184
  }
1105
1185
 
1106
1186
  /**
@@ -1109,11 +1189,13 @@ export function splitAt_<A>(as: Vector<A>, index: number): [Vector<A>, Vector<A>
1109
1189
  *
1110
1190
  * @complexity `O(n)`
1111
1191
  *
1112
- * @tsplus fluent fncts.Vector splitWhen
1192
+ * @tsplus pipeable fncts.Vector splitWhen
1113
1193
  */
1114
- export function splitWhen_<A>(as: Vector<A>, predicate: Predicate<A>): [Vector<A>, Vector<A>] {
1115
- const idx = as.findIndex(predicate);
1116
- return idx === -1 ? [as, Vector.empty()] : as.splitAt(idx);
1194
+ export function splitWhen<A>(predicate: Predicate<A>) {
1195
+ return (as: Vector<A>): [Vector<A>, Vector<A>] => {
1196
+ const idx = as.findIndex(predicate);
1197
+ return idx === -1 ? [as, Vector.empty()] : as.splitAt(idx);
1198
+ };
1117
1199
  }
1118
1200
 
1119
1201
  /**
@@ -1132,10 +1214,12 @@ export function tail<A>(as: Vector<A>): Vector<A> {
1132
1214
  * Takes the first `n` elements from a Vector and returns them in a new Vector.
1133
1215
  *
1134
1216
  * @complexity `O(log(n))`
1135
- * @tsplus fluent fncts.Vector take
1217
+ * @tsplus pipeable fncts.Vector take
1136
1218
  */
1137
- export function take_<A>(as: Vector<A>, n: number): Vector<A> {
1138
- return as.slice(0, n);
1219
+ export function take(n: number) {
1220
+ return <A>(as: Vector<A>): Vector<A> => {
1221
+ return as.slice(0, n);
1222
+ };
1139
1223
  }
1140
1224
 
1141
1225
  /**
@@ -1145,11 +1229,13 @@ export function take_<A>(as: Vector<A>, n: number): Vector<A> {
1145
1229
  * @complexity `O(k + log(n))` where `k` is the number of elements satisfying
1146
1230
  * the predicate.
1147
1231
  *
1148
- * @tsplus fluent fncts.Vector takeWhile
1232
+ * @tsplus pipeable fncts.Vector takeWhile
1149
1233
  */
1150
- export function takeWhile_<A>(as: Vector<A>, predicate: Predicate<A>): Vector<A> {
1151
- const { index } = foldLeftCb(findNotIndexCb, { predicate, index: 0 }, as);
1152
- return as.slice(0, index);
1234
+ export function takeWhile<A>(predicate: Predicate<A>) {
1235
+ return (as: Vector<A>): Vector<A> => {
1236
+ const { index } = foldLeftCb(findNotIndexCb, { predicate, index: 0 }, as);
1237
+ return as.slice(0, index);
1238
+ };
1153
1239
  }
1154
1240
 
1155
1241
  /**
@@ -1157,10 +1243,12 @@ export function takeWhile_<A>(as: Vector<A>, predicate: Predicate<A>): Vector<A>
1157
1243
  * Vector.
1158
1244
  *
1159
1245
  * @complexity `O(log(n))`
1160
- * @tsplus fluent fncts.Vector takeLast
1246
+ * @tsplus pipeable fncts.Vector takeLast
1161
1247
  */
1162
- export function takeLast_<A>(as: Vector<A>, n: number): Vector<A> {
1163
- return as.slice(as.length - n, as.length);
1248
+ export function takeLast(n: number) {
1249
+ return <A>(as: Vector<A>): Vector<A> => {
1250
+ return as.slice(as.length - n, as.length);
1251
+ };
1164
1252
  }
1165
1253
 
1166
1254
  /**
@@ -1170,11 +1258,13 @@ export function takeLast_<A>(as: Vector<A>, n: number): Vector<A> {
1170
1258
  * @complexity `O(k + log(n))` where `k` is the number of elements
1171
1259
  * satisfying the predicate.
1172
1260
  *
1173
- * @tsplus fluent fncts.Vector takeLastWhile
1261
+ * @tsplus pipeable fncts.Vector takeLastWhile
1174
1262
  */
1175
- export function takeLastWhile_<A>(as: Vector<A>, predicate: Predicate<A>): Vector<A> {
1176
- const { index } = foldRightCb(findNotIndexCb, { predicate, index: 0 }, as);
1177
- return as.slice(as.length - index, as.length);
1263
+ export function takeLastWhile<A>(predicate: Predicate<A>) {
1264
+ return (as: Vector<A>): Vector<A> => {
1265
+ const { index } = foldRightCb(findNotIndexCb, { predicate, index: 0 }, as);
1266
+ return as.slice(as.length - index, as.length);
1267
+ };
1178
1268
  }
1179
1269
 
1180
1270
  /**
@@ -1204,19 +1294,42 @@ export function toList<A>(self: Vector<A>): List<A> {
1204
1294
  /**
1205
1295
  * @tsplus getter fncts.Vector traverseWithIndex
1206
1296
  */
1207
- export const traverseWithIndex = TraversableWithIndex.makeTraverseWithIndex<VectorF>()(() => (self) => (G) => (f) => {
1208
- return self.foldLeftWithIndex(G.pure(Vector.emptyPushable()), (i, b, a) =>
1209
- G.zipWith(b, f(i, a), (v, b) => {
1210
- push(v, b);
1211
- return v;
1212
- }),
1213
- );
1214
- });
1297
+ export function _traverseWithIndex<A>(
1298
+ self: Vector<A>,
1299
+ ): <G extends HKT, GC = HKT.None>(
1300
+ G: P.Applicative<G, GC>,
1301
+ ) => <K, Q, W, X, I, S, R, E, B>(
1302
+ f: (i: number, a: A) => HKT.Kind<G, GC, K, Q, W, X, I, S, R, E, B>,
1303
+ ) => HKT.Kind<G, GC, K, Q, W, X, I, S, R, E, Vector<B>>;
1304
+ export function _traverseWithIndex<A>(
1305
+ self: Vector<A>,
1306
+ ): <G>(G: P.Applicative<HKT.F<G>>) => <B>(f: (i: number, a: A) => HKT.FK1<G, B>) => HKT.FK1<G, Vector<B>> {
1307
+ return (G) => (f) =>
1308
+ self.foldLeftWithIndex(G.pure(Vector.emptyPushable()), (i, b, a) =>
1309
+ b.pipe(
1310
+ G.zipWith(f(i, a), (v, b) => {
1311
+ v.push(b);
1312
+ return v;
1313
+ }),
1314
+ ),
1315
+ );
1316
+ }
1215
1317
 
1216
1318
  /**
1217
1319
  * @tsplus getter fncts.Vector traverse
1218
1320
  */
1219
- export const traverse: Traversable<VectorF>["traverse"] = (self) => (G) => (f) =>
1321
+ export function _traverse<A>(self: Vector<A>) {
1322
+ return <G extends HKT, GC = HKT.None>(G: P.Applicative<G, GC>) =>
1323
+ <K, Q, W, X, I, S, R, E, B>(
1324
+ f: (a: A) => HKT.Kind<G, GC, K, Q, W, X, I, S, R, E, B>,
1325
+ ): HKT.Kind<G, GC, K, Q, W, X, I, S, R, E, Vector<B>> =>
1326
+ self.traverseWithIndex(G)((_, a) => f(a));
1327
+ }
1328
+
1329
+ export const traverseWithIndex: P.TraversableWithIndex<VectorF>["traverseWithIndex"] = (G) => (f) => (self) =>
1330
+ self.traverseWithIndex(G)(f);
1331
+
1332
+ export const traverse: Traversable<VectorF>["traverse"] = (G) => (f) => (self) =>
1220
1333
  self.traverseWithIndex(G)((_, a) => f(a));
1221
1334
 
1222
1335
  /**
@@ -1264,10 +1377,12 @@ function findCb<A>(value: A, state: PredState): boolean {
1264
1377
  * If no such element is found the function returns `undefined`.
1265
1378
  *
1266
1379
  * @complexity O(n)
1267
- * @tsplus fluent fncts.Vector unsafeFind
1380
+ * @tsplus pipeable fncts.Vector unsafeFind
1268
1381
  */
1269
- export function unsafeFind_<A>(as: Vector<A>, predicate: Predicate<A>): A | undefined {
1270
- return foldLeftCb<A, PredState>(findCb, { predicate, result: undefined }, as).result;
1382
+ export function unsafeFind<A>(predicate: Predicate<A>) {
1383
+ return (as: Vector<A>): A | undefined => {
1384
+ return foldLeftCb<A, PredState>(findCb, { predicate, result: undefined }, as).result;
1385
+ };
1271
1386
  }
1272
1387
 
1273
1388
  /**
@@ -1275,10 +1390,12 @@ export function unsafeFind_<A>(as: Vector<A>, predicate: Predicate<A>): A | unde
1275
1390
  * If no such element is found the function returns `undefined`.
1276
1391
  *
1277
1392
  * @complexity O(n)
1278
- * @tsplus fluent fncts.Vector unsafeFindLast
1393
+ * @tsplus pipeable fncts.Vector unsafeFindLast
1279
1394
  */
1280
- export function unsafeFindLast_<A>(as: Vector<A>, predicate: Predicate<A>): A | undefined {
1281
- return foldRightCb<A, PredState>(findCb, { predicate, result: undefined }, as).result;
1395
+ export function unsafeFindLast<A>(predicate: Predicate<A>) {
1396
+ return (as: Vector<A>): A | undefined => {
1397
+ return foldRightCb<A, PredState>(findCb, { predicate, result: undefined }, as).result;
1398
+ };
1282
1399
  }
1283
1400
 
1284
1401
  /**
@@ -1286,24 +1403,31 @@ export function unsafeFindLast_<A>(as: Vector<A>, predicate: Predicate<A>): A |
1286
1403
  * `undefined` is returned.
1287
1404
  *
1288
1405
  * @complexity O(log(n))
1289
- * @tsplus fluent fncts.Vector unsafeGet
1406
+ * @tsplus pipeable fncts.Vector unsafeGet
1407
+ * @tsplus pipeable-index fncts.Vector
1290
1408
  */
1291
- export function unsafeGet_<A>(l: Vector<A>, index: number): A | undefined {
1292
- if (index < 0 || l.length <= index) {
1293
- return undefined;
1294
- }
1295
- const prefixSize = getPrefixSize(l);
1296
- const suffixSize = getSuffixSize(l);
1297
- if (index < prefixSize) {
1298
- return l.prefix[prefixSize - index - 1];
1299
- } else if (index >= l.length - suffixSize) {
1300
- return l.suffix[index - (l.length - suffixSize)];
1301
- }
1302
- const { offset } = l;
1303
- const depth = getDepth(l);
1304
- return l.root!.sizes === undefined
1305
- ? nodeNthDense(l.root!, depth, offset === 0 ? index - prefixSize : handleOffset(depth, offset, index - prefixSize))
1306
- : nodeNth(l.root!, depth, offset, index - prefixSize);
1409
+ export function unsafeGet(index: number) {
1410
+ return <A>(l: Vector<A>): A | undefined => {
1411
+ if (index < 0 || l.length <= index) {
1412
+ return undefined;
1413
+ }
1414
+ const prefixSize = getPrefixSize(l);
1415
+ const suffixSize = getSuffixSize(l);
1416
+ if (index < prefixSize) {
1417
+ return l.prefix[prefixSize - index - 1];
1418
+ } else if (index >= l.length - suffixSize) {
1419
+ return l.suffix[index - (l.length - suffixSize)];
1420
+ }
1421
+ const { offset } = l;
1422
+ const depth = getDepth(l);
1423
+ return l.root!.sizes === undefined
1424
+ ? nodeNthDense(
1425
+ l.root!,
1426
+ depth,
1427
+ offset === 0 ? index - prefixSize : handleOffset(depth, offset, index - prefixSize),
1428
+ )
1429
+ : nodeNth(l.root!, depth, offset, index - prefixSize);
1430
+ };
1307
1431
  }
1308
1432
 
1309
1433
  /**
@@ -1336,27 +1460,29 @@ export function unsafeLast<A>(l: Vector<A>): A | undefined {
1336
1460
  * If the index is out of bounds the given Vector is returned unchanged.
1337
1461
  *
1338
1462
  * @complexity O(log(n))
1339
- * @tsplus fluent fncts.Vector updateAt
1463
+ * @tsplus pipeable fncts.Vector updateAt
1340
1464
  */
1341
- export function updateAt_<A>(as: Vector<A>, i: number, a: A): Vector<A> {
1342
- if (i < 0 || as.length <= i) {
1343
- return as;
1344
- }
1345
- const prefixSize = getPrefixSize(as);
1346
- const suffixSize = getSuffixSize(as);
1347
- const newVector = mutableClone(as);
1348
- if (i < prefixSize) {
1349
- const newPrefix = copyArray(newVector.prefix);
1350
- newPrefix[newPrefix.length - i - 1] = a;
1351
- newVector.prefix = newPrefix;
1352
- } else if (i >= as.length - suffixSize) {
1353
- const newSuffix = copyArray(newVector.suffix);
1354
- newSuffix[i - (as.length - suffixSize)] = a;
1355
- newVector.suffix = newSuffix;
1356
- } else {
1357
- newVector.root = updateNode(as.root!, getDepth(as), i - prefixSize, as.offset, a);
1358
- }
1359
- return newVector;
1465
+ export function updateAt<A>(i: number, a: A) {
1466
+ return (as: Vector<A>): Vector<A> => {
1467
+ if (i < 0 || as.length <= i) {
1468
+ return as;
1469
+ }
1470
+ const prefixSize = getPrefixSize(as);
1471
+ const suffixSize = getSuffixSize(as);
1472
+ const newVector = mutableClone(as);
1473
+ if (i < prefixSize) {
1474
+ const newPrefix = copyArray(newVector.prefix);
1475
+ newPrefix[newPrefix.length - i - 1] = a;
1476
+ newVector.prefix = newPrefix;
1477
+ } else if (i >= as.length - suffixSize) {
1478
+ const newSuffix = copyArray(newVector.suffix);
1479
+ newSuffix[i - (as.length - suffixSize)] = a;
1480
+ newVector.suffix = newSuffix;
1481
+ } else {
1482
+ newVector.root = updateNode(as.root!, getDepth(as), i - prefixSize, as.offset, a);
1483
+ }
1484
+ return newVector;
1485
+ };
1360
1486
  }
1361
1487
 
1362
1488
  /**