@fncts/base 0.0.3 → 0.0.4

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 (760) hide show
  1. package/_cjs/collection/Iterable/api/traverseConc.cjs +21 -15
  2. package/_cjs/collection/Iterable/api/traverseConc.cjs.map +1 -1
  3. package/_cjs/collection/Iterable/api.cjs +23 -37
  4. package/_cjs/collection/Iterable/api.cjs.map +1 -1
  5. package/_cjs/collection/compat/Array/api.cjs +1 -1
  6. package/_cjs/collection/compat/Array/api.cjs.map +1 -1
  7. package/_cjs/collection/immutable/Conc/api.cjs +41 -53
  8. package/_cjs/collection/immutable/Conc/api.cjs.map +1 -1
  9. package/_cjs/collection/immutable/Conc/definition.cjs +49 -39
  10. package/_cjs/collection/immutable/Conc/definition.cjs.map +1 -1
  11. package/_cjs/collection/immutable/Dictionary/definition.cjs +4 -2
  12. package/_cjs/collection/immutable/Dictionary/definition.cjs.map +1 -1
  13. package/_cjs/collection/immutable/HashMap/api.cjs +35 -108
  14. package/_cjs/collection/immutable/HashMap/api.cjs.map +1 -1
  15. package/_cjs/collection/immutable/HashMap/definition.cjs +19 -15
  16. package/_cjs/collection/immutable/HashMap/definition.cjs.map +1 -1
  17. package/_cjs/collection/immutable/HashSet/api.cjs +10 -10
  18. package/_cjs/collection/immutable/HashSet/api.cjs.map +1 -1
  19. package/_cjs/collection/immutable/ImmutableArray/api.cjs +153 -248
  20. package/_cjs/collection/immutable/ImmutableArray/api.cjs.map +1 -1
  21. package/_cjs/collection/immutable/ImmutableArray/definition.cjs +12 -10
  22. package/_cjs/collection/immutable/ImmutableArray/definition.cjs.map +1 -1
  23. package/_cjs/collection/immutable/ImmutableArray/instances.cjs +153 -157
  24. package/_cjs/collection/immutable/ImmutableArray/instances.cjs.map +1 -1
  25. package/_cjs/collection/immutable/ImmutableNonEmptyArray/api.cjs +118 -181
  26. package/_cjs/collection/immutable/ImmutableNonEmptyArray/api.cjs.map +1 -1
  27. package/_cjs/collection/immutable/ImmutableNonEmptyArray/definition.cjs +3 -0
  28. package/_cjs/collection/immutable/ImmutableNonEmptyArray/definition.cjs.map +1 -1
  29. package/_cjs/collection/immutable/ImmutableNonEmptyArray/instances.cjs +45 -81
  30. package/_cjs/collection/immutable/ImmutableNonEmptyArray/instances.cjs.map +1 -1
  31. package/_cjs/collection/immutable/List/api.cjs +4 -7
  32. package/_cjs/collection/immutable/List/api.cjs.map +1 -1
  33. package/_cjs/collection/immutable/RoseTree/api.cjs +485 -0
  34. package/_cjs/collection/immutable/RoseTree/api.cjs.map +1 -0
  35. package/_cjs/collection/immutable/RoseTree/definition.cjs +58 -0
  36. package/_cjs/collection/immutable/RoseTree/definition.cjs.map +1 -0
  37. package/_cjs/collection/immutable/RoseTree.cjs +32 -0
  38. package/_cjs/collection/immutable/RoseTree.cjs.map +1 -0
  39. package/_cjs/collection/immutable/SortedMap/api.cjs +65 -65
  40. package/_cjs/collection/immutable/SortedMap/api.cjs.map +1 -1
  41. package/_cjs/collection/immutable/Vector/api.cjs +70 -15
  42. package/_cjs/collection/immutable/Vector/api.cjs.map +1 -1
  43. package/_cjs/collection/immutable/Vector/definition.cjs +13 -11
  44. package/_cjs/collection/immutable/Vector/definition.cjs.map +1 -1
  45. package/_cjs/collection/mutable/HashMap.cjs +5 -5
  46. package/_cjs/collection/mutable/HashMap.cjs.map +1 -1
  47. package/_cjs/collection/mutable/HashSet.cjs +4 -4
  48. package/_cjs/collection/mutable/HashSet.cjs.map +1 -1
  49. package/_cjs/control/Eval/api.cjs +6 -0
  50. package/_cjs/control/Eval/api.cjs.map +1 -1
  51. package/_cjs/control/Eval/definition.cjs +7 -0
  52. package/_cjs/control/Eval/definition.cjs.map +1 -1
  53. package/_cjs/control/Eval/instance.cjs +14 -25
  54. package/_cjs/control/Eval/instance.cjs.map +1 -1
  55. package/_cjs/control/Z/definition.cjs +9 -3
  56. package/_cjs/control/Z/definition.cjs.map +1 -1
  57. package/_cjs/control/Z/instances.cjs +6 -13
  58. package/_cjs/control/Z/instances.cjs.map +1 -1
  59. package/_cjs/data/Branded/definition.cjs +29 -0
  60. package/_cjs/data/Branded/definition.cjs.map +1 -0
  61. package/_cjs/data/Branded/derivations.cjs +58 -0
  62. package/_cjs/data/Branded/derivations.cjs.map +1 -0
  63. package/_cjs/data/Branded.cjs +32 -0
  64. package/_cjs/data/Branded.cjs.map +1 -0
  65. package/_cjs/data/Cause/api/fold.cjs +2 -0
  66. package/_cjs/data/Cause/api/fold.cjs.map +1 -1
  67. package/_cjs/data/Cause/api.cjs +23 -0
  68. package/_cjs/data/Cause/api.cjs.map +1 -1
  69. package/_cjs/data/Const/api.cjs +3 -7
  70. package/_cjs/data/Const/api.cjs.map +1 -1
  71. package/_cjs/data/Const/definition.cjs +19 -1
  72. package/_cjs/data/Const/definition.cjs.map +1 -1
  73. package/_cjs/data/Const/instances.cjs +9 -20
  74. package/_cjs/data/Const/instances.cjs.map +1 -1
  75. package/_cjs/data/DecodeError/definition.cjs +308 -0
  76. package/_cjs/data/DecodeError/definition.cjs.map +1 -0
  77. package/_cjs/data/DecodeError.cjs +19 -0
  78. package/_cjs/data/DecodeError.cjs.map +1 -0
  79. package/_cjs/data/Decoder/api.cjs +217 -0
  80. package/_cjs/data/Decoder/api.cjs.map +1 -0
  81. package/_cjs/data/Decoder/definition.cjs +41 -0
  82. package/_cjs/data/Decoder/definition.cjs.map +1 -0
  83. package/_cjs/data/Decoder.cjs +32 -0
  84. package/_cjs/data/Decoder.cjs.map +1 -0
  85. package/_cjs/data/Duration/api.cjs +22 -9
  86. package/_cjs/data/Duration/api.cjs.map +1 -1
  87. package/_cjs/data/Either/api/alignWith.cjs +2 -0
  88. package/_cjs/data/Either/api/alignWith.cjs.map +1 -1
  89. package/_cjs/data/Either/api.cjs +105 -42
  90. package/_cjs/data/Either/api.cjs.map +1 -1
  91. package/_cjs/data/Either/definition.cjs +39 -10
  92. package/_cjs/data/Either/definition.cjs.map +1 -1
  93. package/_cjs/data/Either/destructors.cjs +2 -0
  94. package/_cjs/data/Either/destructors.cjs.map +1 -1
  95. package/_cjs/data/Either/instances.cjs +123 -40
  96. package/_cjs/data/Either/instances.cjs.map +1 -1
  97. package/_cjs/data/Environment/api.cjs +29 -8
  98. package/_cjs/data/Environment/api.cjs.map +1 -1
  99. package/_cjs/data/Identity/api.cjs +35 -6
  100. package/_cjs/data/Identity/api.cjs.map +1 -1
  101. package/_cjs/data/Identity/definition.cjs +10 -1
  102. package/_cjs/data/Identity/definition.cjs.map +1 -1
  103. package/_cjs/data/Identity/instances.cjs +11 -25
  104. package/_cjs/data/Identity/instances.cjs.map +1 -1
  105. package/_cjs/data/Interval.cjs +154 -0
  106. package/_cjs/data/Interval.cjs.map +1 -0
  107. package/_cjs/data/Maybe/api.cjs +30 -43
  108. package/_cjs/data/Maybe/api.cjs.map +1 -1
  109. package/_cjs/data/Maybe/definition.cjs +45 -18
  110. package/_cjs/data/Maybe/definition.cjs.map +1 -1
  111. package/_cjs/data/Maybe/destructors.cjs +1 -0
  112. package/_cjs/data/Maybe/destructors.cjs.map +1 -1
  113. package/_cjs/data/Maybe/instances.cjs +62 -42
  114. package/_cjs/data/Maybe/instances.cjs.map +1 -1
  115. package/_cjs/data/Newtype.cjs +5 -3
  116. package/_cjs/data/Newtype.cjs.map +1 -1
  117. package/_cjs/data/Patch/api.cjs +1 -1
  118. package/_cjs/data/Patch/api.cjs.map +1 -1
  119. package/_cjs/data/Refinement/api.cjs +0 -4
  120. package/_cjs/data/Refinement/api.cjs.map +1 -1
  121. package/_cjs/data/Struct/definition.cjs +4 -2
  122. package/_cjs/data/Struct/definition.cjs.map +1 -1
  123. package/_cjs/data/These/api.cjs +299 -0
  124. package/_cjs/data/These/api.cjs.map +1 -0
  125. package/_cjs/data/These/constructors.cjs +24 -4
  126. package/_cjs/data/These/constructors.cjs.map +1 -1
  127. package/_cjs/data/These/definition.cjs +16 -0
  128. package/_cjs/data/These/definition.cjs.map +1 -1
  129. package/_cjs/data/These/destructors.cjs +70 -0
  130. package/_cjs/data/These/destructors.cjs.map +1 -1
  131. package/_cjs/data/These/instances.cjs +54 -0
  132. package/_cjs/data/These/instances.cjs.map +1 -0
  133. package/_cjs/data/These.cjs +13 -0
  134. package/_cjs/data/These.cjs.map +1 -1
  135. package/_cjs/data/bigint/definition.cjs +6 -0
  136. package/_cjs/data/bigint/definition.cjs.map +1 -0
  137. package/_cjs/data/bigint/instances.cjs +24 -0
  138. package/_cjs/data/bigint/instances.cjs.map +1 -0
  139. package/_cjs/data/bigint.cjs +32 -0
  140. package/_cjs/data/bigint.cjs.map +1 -0
  141. package/_cjs/data/boolean/definition.cjs +6 -0
  142. package/_cjs/data/boolean/definition.cjs.map +1 -0
  143. package/_cjs/data/boolean/instances.cjs +24 -0
  144. package/_cjs/data/boolean/instances.cjs.map +1 -0
  145. package/_cjs/data/boolean.cjs +32 -0
  146. package/_cjs/data/boolean.cjs.map +1 -0
  147. package/_cjs/data/number/instances.cjs +18 -5
  148. package/_cjs/data/number/instances.cjs.map +1 -1
  149. package/_cjs/data/object/instances.cjs +24 -0
  150. package/_cjs/data/object/instances.cjs.map +1 -0
  151. package/_cjs/data/string/instances.cjs +24 -9
  152. package/_cjs/data/string/instances.cjs.map +1 -1
  153. package/_cjs/internal/Stack.cjs +4 -0
  154. package/_cjs/internal/Stack.cjs.map +1 -1
  155. package/_cjs/json/EitherJson.cjs +33 -0
  156. package/_cjs/json/EitherJson.cjs.map +1 -0
  157. package/_cjs/json/MaybeJson.cjs +31 -0
  158. package/_cjs/json/MaybeJson.cjs.map +1 -0
  159. package/_cjs/json/TheseJson.cjs +37 -0
  160. package/_cjs/json/TheseJson.cjs.map +1 -0
  161. package/_cjs/optics/Optional/definition.cjs +6 -4
  162. package/_cjs/optics/Optional/definition.cjs.map +1 -1
  163. package/_cjs/optics/Traversal/api/compose.cjs +1 -1
  164. package/_cjs/optics/Traversal/api/compose.cjs.map +1 -1
  165. package/_cjs/optics/Traversal/api/fromTraversable.cjs +4 -4
  166. package/_cjs/optics/Traversal/api/fromTraversable.cjs.map +1 -1
  167. package/_cjs/optics/Traversal/definition.cjs +17 -12
  168. package/_cjs/optics/Traversal/definition.cjs.map +1 -1
  169. package/_cjs/typeclass/Align.cjs +0 -20
  170. package/_cjs/typeclass/Align.cjs.map +1 -1
  171. package/_cjs/typeclass/Alt.cjs +5 -15
  172. package/_cjs/typeclass/Alt.cjs.map +1 -1
  173. package/_cjs/typeclass/Alternative.cjs +0 -23
  174. package/_cjs/typeclass/Alternative.cjs.map +1 -1
  175. package/_cjs/typeclass/Applicative.cjs +0 -22
  176. package/_cjs/typeclass/Applicative.cjs.map +1 -1
  177. package/_cjs/typeclass/ApplicativeExcept.cjs +40 -34
  178. package/_cjs/typeclass/ApplicativeExcept.cjs.map +1 -1
  179. package/_cjs/typeclass/Apply.cjs +93 -49
  180. package/_cjs/typeclass/Apply.cjs.map +1 -1
  181. package/_cjs/typeclass/Chain.cjs +40 -17
  182. package/_cjs/typeclass/Chain.cjs.map +1 -1
  183. package/_cjs/typeclass/Closure.cjs +1 -4
  184. package/_cjs/typeclass/Closure.cjs.map +1 -1
  185. package/_cjs/typeclass/Eq/definition.cjs +18 -0
  186. package/_cjs/typeclass/Eq/definition.cjs.map +1 -0
  187. package/_cjs/typeclass/Eq/derivations.cjs +59 -0
  188. package/_cjs/typeclass/Eq/derivations.cjs.map +1 -0
  189. package/_cjs/typeclass/Eq.cjs +11 -13
  190. package/_cjs/typeclass/Eq.cjs.map +1 -1
  191. package/_cjs/typeclass/Fail.cjs +6 -12
  192. package/_cjs/typeclass/Fail.cjs.map +1 -1
  193. package/_cjs/typeclass/Filterable.cjs +31 -18
  194. package/_cjs/typeclass/Filterable.cjs.map +1 -1
  195. package/_cjs/typeclass/FilterableWithIndex.cjs +0 -26
  196. package/_cjs/typeclass/FilterableWithIndex.cjs.map +1 -1
  197. package/_cjs/typeclass/Foldable.cjs +33 -19
  198. package/_cjs/typeclass/Foldable.cjs.map +1 -1
  199. package/_cjs/typeclass/FoldableWithIndex.cjs +33 -21
  200. package/_cjs/typeclass/FoldableWithIndex.cjs.map +1 -1
  201. package/_cjs/typeclass/Functor.cjs +19 -16
  202. package/_cjs/typeclass/Functor.cjs.map +1 -1
  203. package/_cjs/typeclass/FunctorWithIndex.cjs +0 -21
  204. package/_cjs/typeclass/FunctorWithIndex.cjs.map +1 -1
  205. package/_cjs/typeclass/Guard/api.cjs +40 -0
  206. package/_cjs/typeclass/Guard/api.cjs.map +1 -0
  207. package/_cjs/typeclass/Guard/definition.cjs +40 -0
  208. package/_cjs/typeclass/Guard/definition.cjs.map +1 -0
  209. package/_cjs/typeclass/Guard/derivations.cjs +85 -0
  210. package/_cjs/typeclass/Guard/derivations.cjs.map +1 -0
  211. package/_cjs/typeclass/Guard.cjs +32 -0
  212. package/_cjs/typeclass/Guard.cjs.map +1 -0
  213. package/_cjs/typeclass/HashEq.cjs +3 -3
  214. package/_cjs/typeclass/HashEq.cjs.map +1 -1
  215. package/_cjs/typeclass/Monad.cjs +0 -22
  216. package/_cjs/typeclass/Monad.cjs.map +1 -1
  217. package/_cjs/typeclass/MonadExcept.cjs +12 -19
  218. package/_cjs/typeclass/MonadExcept.cjs.map +1 -1
  219. package/_cjs/typeclass/Monoid.cjs +56 -2
  220. package/_cjs/typeclass/Monoid.cjs.map +1 -1
  221. package/_cjs/typeclass/Nil.cjs +10 -0
  222. package/_cjs/typeclass/Nil.cjs.map +1 -1
  223. package/_cjs/typeclass/Ord/api/contramap.cjs +2 -4
  224. package/_cjs/typeclass/Ord/api/contramap.cjs.map +1 -1
  225. package/_cjs/typeclass/Ord/api/max.cjs +1 -1
  226. package/_cjs/typeclass/Ord/api/max.cjs.map +1 -1
  227. package/_cjs/typeclass/Ord/api/min.cjs +1 -1
  228. package/_cjs/typeclass/Ord/api/min.cjs.map +1 -1
  229. package/_cjs/typeclass/Ord/definition.cjs +2 -3
  230. package/_cjs/typeclass/Ord/definition.cjs.map +1 -1
  231. package/_cjs/typeclass/Ord/instances.cjs +7 -7
  232. package/_cjs/typeclass/Ord/instances.cjs.map +1 -1
  233. package/_cjs/typeclass/Pointed.cjs +6 -11
  234. package/_cjs/typeclass/Pointed.cjs.map +1 -1
  235. package/_cjs/typeclass/Semialign.cjs +77 -94
  236. package/_cjs/typeclass/Semialign.cjs.map +1 -1
  237. package/_cjs/typeclass/Semigroup/api.cjs +2 -2
  238. package/_cjs/typeclass/Semigroup/api.cjs.map +1 -1
  239. package/_cjs/typeclass/Semigroup/definition.cjs.map +1 -1
  240. package/_cjs/typeclass/Semigroup/derivations.cjs +63 -0
  241. package/_cjs/typeclass/Semigroup/derivations.cjs.map +1 -0
  242. package/_cjs/typeclass/Semimonoidal.cjs +9 -13
  243. package/_cjs/typeclass/Semimonoidal.cjs.map +1 -1
  244. package/_cjs/typeclass/Showable/show.cjs +11 -11
  245. package/_cjs/typeclass/Showable/show.cjs.map +1 -1
  246. package/_cjs/typeclass/Traversable.cjs +26 -34
  247. package/_cjs/typeclass/Traversable.cjs.map +1 -1
  248. package/_cjs/typeclass/TraversableWithIndex.cjs +7 -38
  249. package/_cjs/typeclass/TraversableWithIndex.cjs.map +1 -1
  250. package/_cjs/typeclass/Witherable.cjs +41 -42
  251. package/_cjs/typeclass/Witherable.cjs.map +1 -1
  252. package/_cjs/typeclass/WitherableWithIndex.cjs +41 -50
  253. package/_cjs/typeclass/WitherableWithIndex.cjs.map +1 -1
  254. package/_cjs/typeclass.cjs +13 -0
  255. package/_cjs/typeclass.cjs.map +1 -1
  256. package/_cjs/util/predicates.cjs +5 -0
  257. package/_cjs/util/predicates.cjs.map +1 -1
  258. package/_mjs/collection/Iterable/api/traverseConc.mjs +20 -15
  259. package/_mjs/collection/Iterable/api/traverseConc.mjs.map +1 -1
  260. package/_mjs/collection/Iterable/api.mjs +21 -31
  261. package/_mjs/collection/Iterable/api.mjs.map +1 -1
  262. package/_mjs/collection/compat/Array/api.mjs +1 -1
  263. package/_mjs/collection/compat/Array/api.mjs.map +1 -1
  264. package/_mjs/collection/immutable/Conc/api.mjs +35 -36
  265. package/_mjs/collection/immutable/Conc/api.mjs.map +1 -1
  266. package/_mjs/collection/immutable/Conc/definition.mjs +48 -39
  267. package/_mjs/collection/immutable/Conc/definition.mjs.map +1 -1
  268. package/_mjs/collection/immutable/Dictionary/definition.mjs +3 -2
  269. package/_mjs/collection/immutable/Dictionary/definition.mjs.map +1 -1
  270. package/_mjs/collection/immutable/HashMap/api.mjs +26 -66
  271. package/_mjs/collection/immutable/HashMap/api.mjs.map +1 -1
  272. package/_mjs/collection/immutable/HashMap/definition.mjs +18 -15
  273. package/_mjs/collection/immutable/HashMap/definition.mjs.map +1 -1
  274. package/_mjs/collection/immutable/HashSet/api.mjs +5 -5
  275. package/_mjs/collection/immutable/HashSet/api.mjs.map +1 -1
  276. package/_mjs/collection/immutable/ImmutableArray/api.mjs +135 -177
  277. package/_mjs/collection/immutable/ImmutableArray/api.mjs.map +1 -1
  278. package/_mjs/collection/immutable/ImmutableArray/definition.mjs +11 -10
  279. package/_mjs/collection/immutable/ImmutableArray/definition.mjs.map +1 -1
  280. package/_mjs/collection/immutable/ImmutableArray/instances.mjs +151 -138
  281. package/_mjs/collection/immutable/ImmutableArray/instances.mjs.map +1 -1
  282. package/_mjs/collection/immutable/ImmutableNonEmptyArray/api.mjs +108 -142
  283. package/_mjs/collection/immutable/ImmutableNonEmptyArray/api.mjs.map +1 -1
  284. package/_mjs/collection/immutable/ImmutableNonEmptyArray/definition.mjs +2 -0
  285. package/_mjs/collection/immutable/ImmutableNonEmptyArray/definition.mjs.map +1 -1
  286. package/_mjs/collection/immutable/ImmutableNonEmptyArray/instances.mjs +46 -67
  287. package/_mjs/collection/immutable/ImmutableNonEmptyArray/instances.mjs.map +1 -1
  288. package/_mjs/collection/immutable/List/api.mjs +4 -5
  289. package/_mjs/collection/immutable/List/api.mjs.map +1 -1
  290. package/_mjs/collection/immutable/RoseTree/api.mjs +447 -0
  291. package/_mjs/collection/immutable/RoseTree/api.mjs.map +1 -0
  292. package/_mjs/collection/immutable/RoseTree/definition.mjs +35 -0
  293. package/_mjs/collection/immutable/RoseTree/definition.mjs.map +1 -0
  294. package/_mjs/collection/immutable/RoseTree.mjs +4 -0
  295. package/_mjs/collection/immutable/RoseTree.mjs.map +1 -0
  296. package/_mjs/collection/immutable/SortedMap/api.mjs +65 -65
  297. package/_mjs/collection/immutable/SortedMap/api.mjs.map +1 -1
  298. package/_mjs/collection/immutable/Vector/api.mjs +59 -15
  299. package/_mjs/collection/immutable/Vector/api.mjs.map +1 -1
  300. package/_mjs/collection/immutable/Vector/definition.mjs +12 -11
  301. package/_mjs/collection/immutable/Vector/definition.mjs.map +1 -1
  302. package/_mjs/collection/mutable/HashMap.mjs +5 -5
  303. package/_mjs/collection/mutable/HashMap.mjs.map +1 -1
  304. package/_mjs/collection/mutable/HashSet.mjs +4 -4
  305. package/_mjs/collection/mutable/HashSet.mjs.map +1 -1
  306. package/_mjs/control/Eval/api.mjs +5 -2
  307. package/_mjs/control/Eval/api.mjs.map +1 -1
  308. package/_mjs/control/Eval/definition.mjs +1 -0
  309. package/_mjs/control/Eval/definition.mjs.map +1 -1
  310. package/_mjs/control/Eval/instance.mjs +15 -18
  311. package/_mjs/control/Eval/instance.mjs.map +1 -1
  312. package/_mjs/control/Z/definition.mjs +2 -0
  313. package/_mjs/control/Z/definition.mjs.map +1 -1
  314. package/_mjs/control/Z/instances.mjs +7 -8
  315. package/_mjs/control/Z/instances.mjs.map +1 -1
  316. package/_mjs/data/Branded/definition.mjs +18 -0
  317. package/_mjs/data/Branded/definition.mjs.map +1 -0
  318. package/_mjs/data/Branded/derivations.mjs +39 -0
  319. package/_mjs/data/Branded/derivations.mjs.map +1 -0
  320. package/_mjs/data/Branded.mjs +4 -0
  321. package/_mjs/data/Branded.mjs.map +1 -0
  322. package/_mjs/data/Cause/api/fold.mjs +2 -0
  323. package/_mjs/data/Cause/api/fold.mjs.map +1 -1
  324. package/_mjs/data/Cause/api.mjs +20 -0
  325. package/_mjs/data/Cause/api.mjs.map +1 -1
  326. package/_mjs/data/Const/api.mjs +3 -3
  327. package/_mjs/data/Const/api.mjs.map +1 -1
  328. package/_mjs/data/Const/definition.mjs +13 -1
  329. package/_mjs/data/Const/definition.mjs.map +1 -1
  330. package/_mjs/data/Const/instances.mjs +7 -15
  331. package/_mjs/data/Const/instances.mjs.map +1 -1
  332. package/_mjs/data/DecodeError/definition.mjs +226 -0
  333. package/_mjs/data/DecodeError/definition.mjs.map +1 -0
  334. package/_mjs/data/DecodeError.mjs +3 -0
  335. package/_mjs/data/DecodeError.mjs.map +1 -0
  336. package/_mjs/data/Decoder/api.mjs +179 -0
  337. package/_mjs/data/Decoder/api.mjs.map +1 -0
  338. package/_mjs/data/Decoder/definition.mjs +24 -0
  339. package/_mjs/data/Decoder/definition.mjs.map +1 -0
  340. package/_mjs/data/Decoder.mjs +4 -0
  341. package/_mjs/data/Decoder.mjs.map +1 -0
  342. package/_mjs/data/Duration/api.mjs +17 -8
  343. package/_mjs/data/Duration/api.mjs.map +1 -1
  344. package/_mjs/data/Either/api/alignWith.mjs +2 -0
  345. package/_mjs/data/Either/api/alignWith.mjs.map +1 -1
  346. package/_mjs/data/Either/api.mjs +91 -21
  347. package/_mjs/data/Either/api.mjs.map +1 -1
  348. package/_mjs/data/Either/definition.mjs +25 -5
  349. package/_mjs/data/Either/definition.mjs.map +1 -1
  350. package/_mjs/data/Either/destructors.mjs +2 -0
  351. package/_mjs/data/Either/destructors.mjs.map +1 -1
  352. package/_mjs/data/Either/instances.mjs +109 -39
  353. package/_mjs/data/Either/instances.mjs.map +1 -1
  354. package/_mjs/data/Environment/api.mjs +23 -7
  355. package/_mjs/data/Environment/api.mjs.map +1 -1
  356. package/_mjs/data/Identity/api.mjs +24 -5
  357. package/_mjs/data/Identity/api.mjs.map +1 -1
  358. package/_mjs/data/Identity/definition.mjs +3 -1
  359. package/_mjs/data/Identity/definition.mjs.map +1 -1
  360. package/_mjs/data/Identity/instances.mjs +12 -18
  361. package/_mjs/data/Identity/instances.mjs.map +1 -1
  362. package/_mjs/data/Interval.mjs +114 -0
  363. package/_mjs/data/Interval.mjs.map +1 -0
  364. package/_mjs/data/Maybe/api.mjs +30 -35
  365. package/_mjs/data/Maybe/api.mjs.map +1 -1
  366. package/_mjs/data/Maybe/definition.mjs +37 -14
  367. package/_mjs/data/Maybe/definition.mjs.map +1 -1
  368. package/_mjs/data/Maybe/destructors.mjs +1 -0
  369. package/_mjs/data/Maybe/destructors.mjs.map +1 -1
  370. package/_mjs/data/Maybe/instances.mjs +56 -39
  371. package/_mjs/data/Maybe/instances.mjs.map +1 -1
  372. package/_mjs/data/Newtype.mjs +4 -3
  373. package/_mjs/data/Newtype.mjs.map +1 -1
  374. package/_mjs/data/Patch/api.mjs +1 -1
  375. package/_mjs/data/Patch/api.mjs.map +1 -1
  376. package/_mjs/data/Refinement/api.mjs +0 -4
  377. package/_mjs/data/Refinement/api.mjs.map +1 -1
  378. package/_mjs/data/Struct/definition.mjs +3 -2
  379. package/_mjs/data/Struct/definition.mjs.map +1 -1
  380. package/_mjs/data/These/api.mjs +262 -0
  381. package/_mjs/data/These/api.mjs.map +1 -0
  382. package/_mjs/data/These/constructors.mjs +14 -2
  383. package/_mjs/data/These/constructors.mjs.map +1 -1
  384. package/_mjs/data/These/definition.mjs +8 -0
  385. package/_mjs/data/These/definition.mjs.map +1 -1
  386. package/_mjs/data/These/destructors.mjs +53 -0
  387. package/_mjs/data/These/destructors.mjs.map +1 -1
  388. package/_mjs/data/These/instances.mjs +36 -0
  389. package/_mjs/data/These/instances.mjs.map +1 -0
  390. package/_mjs/data/These.mjs +1 -0
  391. package/_mjs/data/These.mjs.map +1 -1
  392. package/_mjs/data/bigint/definition.mjs +2 -0
  393. package/_mjs/data/bigint/definition.mjs.map +1 -0
  394. package/_mjs/data/bigint/instances.mjs +10 -0
  395. package/_mjs/data/bigint/instances.mjs.map +1 -0
  396. package/_mjs/data/bigint.mjs +4 -0
  397. package/_mjs/data/bigint.mjs.map +1 -0
  398. package/_mjs/data/boolean/definition.mjs +2 -0
  399. package/_mjs/data/boolean/definition.mjs.map +1 -0
  400. package/_mjs/data/boolean/instances.mjs +10 -0
  401. package/_mjs/data/boolean/instances.mjs.map +1 -0
  402. package/_mjs/data/boolean.mjs +4 -0
  403. package/_mjs/data/boolean.mjs.map +1 -0
  404. package/_mjs/data/number/instances.mjs +14 -4
  405. package/_mjs/data/number/instances.mjs.map +1 -1
  406. package/_mjs/data/object/instances.mjs +10 -0
  407. package/_mjs/data/object/instances.mjs.map +1 -0
  408. package/_mjs/data/string/instances.mjs +20 -8
  409. package/_mjs/data/string/instances.mjs.map +1 -1
  410. package/_mjs/internal/Stack.mjs +4 -0
  411. package/_mjs/internal/Stack.mjs.map +1 -1
  412. package/_mjs/json/EitherJson.mjs +18 -0
  413. package/_mjs/json/EitherJson.mjs.map +1 -0
  414. package/_mjs/json/MaybeJson.mjs +16 -0
  415. package/_mjs/json/MaybeJson.mjs.map +1 -0
  416. package/_mjs/json/TheseJson.mjs +22 -0
  417. package/_mjs/json/TheseJson.mjs.map +1 -0
  418. package/_mjs/optics/Optional/definition.mjs +5 -4
  419. package/_mjs/optics/Optional/definition.mjs.map +1 -1
  420. package/_mjs/optics/Traversal/api/compose.mjs +1 -1
  421. package/_mjs/optics/Traversal/api/compose.mjs.map +1 -1
  422. package/_mjs/optics/Traversal/api/fromTraversable.mjs +5 -4
  423. package/_mjs/optics/Traversal/api/fromTraversable.mjs.map +1 -1
  424. package/_mjs/optics/Traversal/definition.mjs +14 -12
  425. package/_mjs/optics/Traversal/definition.mjs.map +1 -1
  426. package/_mjs/typeclass/Align.mjs +0 -11
  427. package/_mjs/typeclass/Align.mjs.map +1 -1
  428. package/_mjs/typeclass/Alt.mjs +4 -7
  429. package/_mjs/typeclass/Alt.mjs.map +1 -1
  430. package/_mjs/typeclass/Alternative.mjs +0 -13
  431. package/_mjs/typeclass/Alternative.mjs.map +1 -1
  432. package/_mjs/typeclass/Applicative.mjs +0 -12
  433. package/_mjs/typeclass/Applicative.mjs.map +1 -1
  434. package/_mjs/typeclass/ApplicativeExcept.mjs +32 -24
  435. package/_mjs/typeclass/ApplicativeExcept.mjs.map +1 -1
  436. package/_mjs/typeclass/Apply.mjs +85 -42
  437. package/_mjs/typeclass/Apply.mjs.map +1 -1
  438. package/_mjs/typeclass/Chain.mjs +33 -12
  439. package/_mjs/typeclass/Chain.mjs.map +1 -1
  440. package/_mjs/typeclass/Closure.mjs +1 -4
  441. package/_mjs/typeclass/Closure.mjs.map +1 -1
  442. package/_mjs/typeclass/Eq/definition.mjs +9 -0
  443. package/_mjs/typeclass/Eq/definition.mjs.map +1 -0
  444. package/_mjs/typeclass/Eq/derivations.mjs +46 -0
  445. package/_mjs/typeclass/Eq/derivations.mjs.map +1 -0
  446. package/_mjs/typeclass/Eq.mjs +1 -11
  447. package/_mjs/typeclass/Eq.mjs.map +1 -1
  448. package/_mjs/typeclass/Fail.mjs +5 -7
  449. package/_mjs/typeclass/Fail.mjs.map +1 -1
  450. package/_mjs/typeclass/Filterable.mjs +27 -13
  451. package/_mjs/typeclass/Filterable.mjs.map +1 -1
  452. package/_mjs/typeclass/FilterableWithIndex.mjs +0 -16
  453. package/_mjs/typeclass/FilterableWithIndex.mjs.map +1 -1
  454. package/_mjs/typeclass/Foldable.mjs +29 -12
  455. package/_mjs/typeclass/Foldable.mjs.map +1 -1
  456. package/_mjs/typeclass/FoldableWithIndex.mjs +29 -13
  457. package/_mjs/typeclass/FoldableWithIndex.mjs.map +1 -1
  458. package/_mjs/typeclass/Functor.mjs +16 -9
  459. package/_mjs/typeclass/Functor.mjs.map +1 -1
  460. package/_mjs/typeclass/FunctorWithIndex.mjs +0 -12
  461. package/_mjs/typeclass/FunctorWithIndex.mjs.map +1 -1
  462. package/_mjs/typeclass/Guard/api.mjs +23 -0
  463. package/_mjs/typeclass/Guard/api.mjs.map +1 -0
  464. package/_mjs/typeclass/Guard/definition.mjs +23 -0
  465. package/_mjs/typeclass/Guard/definition.mjs.map +1 -0
  466. package/_mjs/typeclass/Guard/derivations.mjs +67 -0
  467. package/_mjs/typeclass/Guard/derivations.mjs.map +1 -0
  468. package/_mjs/typeclass/Guard.mjs +4 -0
  469. package/_mjs/typeclass/Guard.mjs.map +1 -0
  470. package/_mjs/typeclass/HashEq.mjs +3 -3
  471. package/_mjs/typeclass/HashEq.mjs.map +1 -1
  472. package/_mjs/typeclass/Monad.mjs +0 -12
  473. package/_mjs/typeclass/Monad.mjs.map +1 -1
  474. package/_mjs/typeclass/MonadExcept.mjs +9 -13
  475. package/_mjs/typeclass/MonadExcept.mjs.map +1 -1
  476. package/_mjs/typeclass/Monoid.mjs +50 -1
  477. package/_mjs/typeclass/Monoid.mjs.map +1 -1
  478. package/_mjs/typeclass/Nil.mjs +8 -1
  479. package/_mjs/typeclass/Nil.mjs.map +1 -1
  480. package/_mjs/typeclass/Ord/api/contramap.mjs +2 -4
  481. package/_mjs/typeclass/Ord/api/contramap.mjs.map +1 -1
  482. package/_mjs/typeclass/Ord/api/max.mjs +1 -1
  483. package/_mjs/typeclass/Ord/api/max.mjs.map +1 -1
  484. package/_mjs/typeclass/Ord/api/min.mjs +1 -1
  485. package/_mjs/typeclass/Ord/api/min.mjs.map +1 -1
  486. package/_mjs/typeclass/Ord/definition.mjs +2 -3
  487. package/_mjs/typeclass/Ord/definition.mjs.map +1 -1
  488. package/_mjs/typeclass/Ord/instances.mjs +7 -7
  489. package/_mjs/typeclass/Ord/instances.mjs.map +1 -1
  490. package/_mjs/typeclass/Pointed.mjs +5 -4
  491. package/_mjs/typeclass/Pointed.mjs.map +1 -1
  492. package/_mjs/typeclass/Semialign.mjs +67 -74
  493. package/_mjs/typeclass/Semialign.mjs.map +1 -1
  494. package/_mjs/typeclass/Semigroup/api.mjs +2 -2
  495. package/_mjs/typeclass/Semigroup/api.mjs.map +1 -1
  496. package/_mjs/typeclass/Semigroup/definition.mjs.map +1 -1
  497. package/_mjs/typeclass/Semigroup/derivations.mjs +50 -0
  498. package/_mjs/typeclass/Semigroup/derivations.mjs.map +1 -0
  499. package/_mjs/typeclass/Semigroup.mjs +1 -1
  500. package/_mjs/typeclass/Semimonoidal.mjs +8 -6
  501. package/_mjs/typeclass/Semimonoidal.mjs.map +1 -1
  502. package/_mjs/typeclass/Showable/show.mjs +11 -11
  503. package/_mjs/typeclass/Showable/show.mjs.map +1 -1
  504. package/_mjs/typeclass/Traversable.mjs +25 -24
  505. package/_mjs/typeclass/Traversable.mjs.map +1 -1
  506. package/_mjs/typeclass/TraversableWithIndex.mjs +6 -24
  507. package/_mjs/typeclass/TraversableWithIndex.mjs.map +1 -1
  508. package/_mjs/typeclass/Witherable.mjs +39 -32
  509. package/_mjs/typeclass/Witherable.mjs.map +1 -1
  510. package/_mjs/typeclass/WitherableWithIndex.mjs +39 -37
  511. package/_mjs/typeclass/WitherableWithIndex.mjs.map +1 -1
  512. package/_mjs/typeclass.mjs +1 -0
  513. package/_mjs/typeclass.mjs.map +1 -1
  514. package/_mjs/util/predicates.mjs +3 -0
  515. package/_mjs/util/predicates.mjs.map +1 -1
  516. package/_src/collection/Iterable/api/traverseConc.ts +21 -29
  517. package/_src/collection/Iterable/api.ts +20 -34
  518. package/_src/collection/compat/Array/api.ts +1 -1
  519. package/_src/collection/immutable/Conc/api.ts +26 -46
  520. package/_src/collection/immutable/Conc/definition.ts +19 -8
  521. package/_src/collection/immutable/Dictionary/definition.ts +1 -1
  522. package/_src/collection/immutable/HashMap/api.ts +24 -81
  523. package/_src/collection/immutable/HashMap/definition.ts +7 -9
  524. package/_src/collection/immutable/HashMap/internal.ts +1 -1
  525. package/_src/collection/immutable/HashSet/api.ts +4 -4
  526. package/_src/collection/immutable/ImmutableArray/api.ts +180 -219
  527. package/_src/collection/immutable/ImmutableArray/definition.ts +6 -8
  528. package/_src/collection/immutable/ImmutableArray/instances.ts +156 -134
  529. package/_src/collection/immutable/ImmutableNonEmptyArray/api.ts +87 -158
  530. package/_src/collection/immutable/ImmutableNonEmptyArray/definition.ts +4 -8
  531. package/_src/collection/immutable/ImmutableNonEmptyArray/instances.ts +39 -49
  532. package/_src/collection/immutable/List/api.ts +2 -6
  533. package/_src/collection/immutable/RoseTree/api.ts +278 -0
  534. package/_src/collection/immutable/RoseTree/definition.ts +29 -0
  535. package/_src/collection/immutable/RoseTree.ts +4 -0
  536. package/_src/collection/immutable/SortedMap/api.ts +56 -53
  537. package/_src/collection/immutable/Vector/api.ts +57 -17
  538. package/_src/collection/immutable/Vector/definition.ts +10 -0
  539. package/_src/collection/mutable/HashMap.ts +5 -5
  540. package/_src/collection/mutable/HashSet.ts +4 -4
  541. package/_src/control/Eval/api.ts +5 -1
  542. package/_src/control/Eval/definition.ts +5 -8
  543. package/_src/control/Eval/instance.ts +16 -15
  544. package/_src/control/Z/definition.ts +26 -19
  545. package/_src/control/Z/instances.ts +9 -8
  546. package/_src/data/Branded/definition.ts +47 -0
  547. package/_src/data/Branded/derivations.ts +57 -0
  548. package/_src/data/Branded.ts +4 -0
  549. package/_src/data/Cause/api/fold.ts +1 -0
  550. package/_src/data/Cause/api.ts +18 -0
  551. package/_src/data/Const/api.ts +3 -3
  552. package/_src/data/Const/definition.ts +22 -5
  553. package/_src/data/Const/instances.ts +12 -21
  554. package/_src/data/DecodeError/definition.ts +227 -0
  555. package/_src/data/DecodeError.ts +3 -0
  556. package/_src/data/Decoder/api.ts +198 -0
  557. package/_src/data/Decoder/definition.ts +25 -0
  558. package/_src/data/Decoder.ts +4 -0
  559. package/_src/data/Duration/api.ts +21 -14
  560. package/_src/data/Either/api/alignWith.ts +2 -0
  561. package/_src/data/Either/api.ts +85 -30
  562. package/_src/data/Either/definition.ts +41 -19
  563. package/_src/data/Either/destructors.ts +1 -0
  564. package/_src/data/Either/instances.ts +102 -51
  565. package/_src/data/Environment/api.ts +19 -4
  566. package/_src/data/Identity/api.ts +19 -4
  567. package/_src/data/Identity/definition.ts +7 -3
  568. package/_src/data/Identity/instances.ts +15 -8
  569. package/_src/data/Interval.ts +103 -0
  570. package/_src/data/Maybe/api.ts +21 -31
  571. package/_src/data/Maybe/definition.ts +31 -19
  572. package/_src/data/Maybe/destructors.ts +1 -0
  573. package/_src/data/Maybe/instances.ts +61 -34
  574. package/_src/data/Newtype.ts +11 -32
  575. package/_src/data/Patch/api.ts +1 -1
  576. package/_src/data/Refinement/api.ts +4 -2
  577. package/_src/data/Struct/definition.ts +1 -1
  578. package/_src/data/These/api.ts +184 -0
  579. package/_src/data/These/constructors.ts +10 -0
  580. package/_src/data/These/definition.ts +7 -0
  581. package/_src/data/These/destructors.ts +45 -0
  582. package/_src/data/These/instances.ts +43 -0
  583. package/_src/data/These.ts +1 -0
  584. package/_src/data/bigint/definition.ts +13 -0
  585. package/_src/data/bigint/instances.ts +8 -0
  586. package/_src/data/bigint.ts +4 -0
  587. package/_src/data/boolean/definition.ts +13 -0
  588. package/_src/data/boolean/instances.ts +8 -0
  589. package/_src/data/boolean.ts +4 -0
  590. package/_src/data/number/instances.ts +13 -3
  591. package/_src/data/object/instances.ts +7 -0
  592. package/_src/data/string/instances.ts +17 -5
  593. package/_src/internal/Stack.ts +4 -0
  594. package/_src/json/EitherJson.ts +28 -0
  595. package/_src/json/MaybeJson.ts +27 -0
  596. package/_src/json/TheseJson.ts +31 -0
  597. package/_src/optics/Optional/definition.ts +2 -2
  598. package/_src/optics/Traversal/api/compose.ts +1 -1
  599. package/_src/optics/Traversal/api/fromTraversable.ts +15 -41
  600. package/_src/optics/Traversal/definition.ts +21 -23
  601. package/_src/typeclass/Align.ts +4 -18
  602. package/_src/typeclass/Alt.ts +59 -90
  603. package/_src/typeclass/Alternative.ts +4 -20
  604. package/_src/typeclass/Applicative.ts +3 -23
  605. package/_src/typeclass/ApplicativeExcept.ts +94 -193
  606. package/_src/typeclass/Apply.ts +319 -509
  607. package/_src/typeclass/Chain.ts +127 -199
  608. package/_src/typeclass/Closure.ts +4 -20
  609. package/_src/typeclass/Eq/definition.ts +20 -0
  610. package/_src/typeclass/Eq/derivations.ts +61 -0
  611. package/_src/typeclass/Eq.ts +2 -36
  612. package/_src/typeclass/Fail.ts +28 -27
  613. package/_src/typeclass/Filterable.ts +70 -117
  614. package/_src/typeclass/FilterableWithIndex.ts +27 -131
  615. package/_src/typeclass/Foldable.ts +35 -52
  616. package/_src/typeclass/FoldableWithIndex.ts +40 -75
  617. package/_src/typeclass/Functor.ts +21 -59
  618. package/_src/typeclass/FunctorWithIndex.ts +6 -34
  619. package/_src/typeclass/Guard/api.ts +32 -0
  620. package/_src/typeclass/Guard/definition.ts +23 -0
  621. package/_src/typeclass/Guard/derivations.ts +80 -0
  622. package/_src/typeclass/Guard.ts +5 -0
  623. package/_src/typeclass/HashEq.ts +3 -4
  624. package/_src/typeclass/Monad.ts +3 -18
  625. package/_src/typeclass/MonadExcept.ts +9 -32
  626. package/_src/typeclass/Monoid.ts +60 -2
  627. package/_src/typeclass/Nil.ts +26 -17
  628. package/_src/typeclass/Ord/api/contramap.ts +2 -4
  629. package/_src/typeclass/Ord/api/max.ts +1 -1
  630. package/_src/typeclass/Ord/api/min.ts +1 -1
  631. package/_src/typeclass/Ord/definition.ts +3 -19
  632. package/_src/typeclass/Ord/instances.ts +6 -6
  633. package/_src/typeclass/Pointed.ts +29 -25
  634. package/_src/typeclass/Semialign.ts +308 -444
  635. package/_src/typeclass/Semigroup/api.ts +2 -2
  636. package/_src/typeclass/Semigroup/definition.ts +2 -6
  637. package/_src/typeclass/Semigroup/derivations.ts +64 -0
  638. package/_src/typeclass/Semigroup.ts +1 -1
  639. package/_src/typeclass/Semimonoidal.ts +55 -84
  640. package/_src/typeclass/Showable/show.ts +6 -8
  641. package/_src/typeclass/Traversable.ts +67 -157
  642. package/_src/typeclass/TraversableWithIndex.ts +37 -127
  643. package/_src/typeclass/Witherable.ts +120 -279
  644. package/_src/typeclass/WitherableWithIndex.ts +129 -337
  645. package/_src/typeclass.ts +2 -0
  646. package/_src/util/predicates.ts +4 -0
  647. package/collection/Iterable/api/traverseConc.d.ts +6 -4
  648. package/collection/Iterable/api.d.ts +5 -13
  649. package/collection/immutable/Conc/api.d.ts +15 -23
  650. package/collection/immutable/Conc/definition.d.ts +10 -7
  651. package/collection/immutable/Dictionary/definition.d.ts +1 -1
  652. package/collection/immutable/HashMap/api.d.ts +15 -27
  653. package/collection/immutable/HashMap/definition.d.ts +6 -9
  654. package/collection/immutable/HashMap/internal.d.ts +1 -1
  655. package/collection/immutable/ImmutableArray/api.d.ts +42 -94
  656. package/collection/immutable/ImmutableArray/definition.d.ts +6 -8
  657. package/collection/immutable/ImmutableArray/instances.d.ts +86 -17
  658. package/collection/immutable/ImmutableNonEmptyArray/api.d.ts +26 -47
  659. package/collection/immutable/ImmutableNonEmptyArray/definition.d.ts +4 -8
  660. package/collection/immutable/ImmutableNonEmptyArray/instances.d.ts +1 -1
  661. package/collection/immutable/List/api.d.ts +1 -2
  662. package/collection/immutable/RoseTree/api.d.ts +63 -0
  663. package/collection/immutable/RoseTree/definition.d.ts +23 -0
  664. package/collection/immutable/RoseTree.d.ts +2 -0
  665. package/collection/immutable/SortedMap/api.d.ts +2 -1
  666. package/collection/immutable/Vector/api.d.ts +31 -8
  667. package/collection/immutable/Vector/definition.d.ts +10 -0
  668. package/control/Eval/api.d.ts +1 -0
  669. package/control/Eval/definition.d.ts +5 -8
  670. package/control/Eval/instance.d.ts +4 -1
  671. package/control/Z/definition.d.ts +23 -18
  672. package/control/Z/instances.d.ts +4 -3
  673. package/data/Branded/definition.d.ts +36 -0
  674. package/data/Branded/derivations.d.ts +24 -0
  675. package/data/Branded.d.ts +2 -0
  676. package/data/Cause/api.d.ts +7 -1
  677. package/data/Const/api.d.ts +1 -1
  678. package/data/Const/definition.d.ts +23 -7
  679. package/data/Const/instances.d.ts +4 -12
  680. package/data/DecodeError/definition.d.ts +141 -0
  681. package/data/DecodeError.d.ts +1 -0
  682. package/data/Decoder/api.d.ts +65 -0
  683. package/data/Decoder/definition.d.ts +24 -0
  684. package/data/Decoder.d.ts +2 -0
  685. package/data/Duration/api.d.ts +12 -8
  686. package/data/Either/api.d.ts +29 -17
  687. package/data/Either/definition.d.ts +31 -14
  688. package/data/Either/instances.d.ts +26 -11
  689. package/data/Environment/api.d.ts +5 -0
  690. package/data/Identity/api.d.ts +11 -0
  691. package/data/Identity/definition.d.ts +7 -2
  692. package/data/Identity/instances.d.ts +5 -9
  693. package/data/Interval.d.ts +71 -0
  694. package/data/Maybe/api.d.ts +3 -17
  695. package/data/Maybe/definition.d.ts +20 -14
  696. package/data/Maybe/instances.d.ts +14 -8
  697. package/data/Newtype.d.ts +8 -9
  698. package/data/Refinement/api.d.ts +2 -0
  699. package/data/Struct/definition.d.ts +1 -1
  700. package/data/These/api.d.ts +73 -0
  701. package/data/These/constructors.d.ts +7 -1
  702. package/data/These/definition.d.ts +5 -0
  703. package/data/These/destructors.d.ts +27 -1
  704. package/data/These/instances.d.ts +13 -0
  705. package/data/These.d.ts +1 -0
  706. package/data/bigint/definition.d.ts +13 -0
  707. package/data/bigint/instances.d.ts +7 -0
  708. package/data/bigint.d.ts +2 -0
  709. package/data/boolean/definition.d.ts +13 -0
  710. package/data/boolean/instances.d.ts +7 -0
  711. package/data/boolean.d.ts +2 -0
  712. package/data/number/instances.d.ts +8 -0
  713. package/data/object/instances.d.ts +7 -0
  714. package/data/string/instances.d.ts +10 -0
  715. package/internal/Stack.d.ts +1 -0
  716. package/json/EitherJson.d.ts +24 -0
  717. package/json/MaybeJson.d.ts +23 -0
  718. package/json/TheseJson.d.ts +26 -0
  719. package/optics/Traversal/api/fromTraversable.d.ts +1 -1
  720. package/optics/Traversal/definition.d.ts +4 -9
  721. package/package.json +2 -2
  722. package/typeclass/Align.d.ts +3 -10
  723. package/typeclass/Alt.d.ts +6 -19
  724. package/typeclass/Alternative.d.ts +4 -12
  725. package/typeclass/Applicative.d.ts +3 -12
  726. package/typeclass/ApplicativeExcept.d.ts +14 -39
  727. package/typeclass/Apply.d.ts +41 -72
  728. package/typeclass/Chain.d.ts +18 -28
  729. package/typeclass/Closure.d.ts +2 -12
  730. package/typeclass/Eq/definition.d.ts +17 -0
  731. package/typeclass/Eq/derivations.d.ts +24 -0
  732. package/typeclass/Eq.d.ts +2 -27
  733. package/typeclass/Fail.d.ts +4 -10
  734. package/typeclass/Filterable.d.ts +30 -51
  735. package/typeclass/FilterableWithIndex.d.ts +10 -53
  736. package/typeclass/Foldable.d.ts +19 -31
  737. package/typeclass/FoldableWithIndex.d.ts +20 -33
  738. package/typeclass/Functor.d.ts +11 -22
  739. package/typeclass/FunctorWithIndex.d.ts +3 -19
  740. package/typeclass/Guard/api.d.ts +20 -0
  741. package/typeclass/Guard/definition.d.ts +22 -0
  742. package/typeclass/Guard/derivations.d.ts +36 -0
  743. package/typeclass/Guard.d.ts +2 -0
  744. package/typeclass/HashEq.d.ts +1 -2
  745. package/typeclass/Monad.d.ts +3 -11
  746. package/typeclass/MonadExcept.d.ts +6 -17
  747. package/typeclass/Monoid.d.ts +24 -2
  748. package/typeclass/Nil.d.ts +7 -8
  749. package/typeclass/Ord/definition.d.ts +2 -14
  750. package/typeclass/Pointed.d.ts +4 -10
  751. package/typeclass/Semialign.d.ts +51 -63
  752. package/typeclass/Semigroup/definition.d.ts +3 -5
  753. package/typeclass/Semigroup/derivations.d.ts +25 -0
  754. package/typeclass/Semimonoidal.d.ts +5 -14
  755. package/typeclass/Traversable.d.ts +17 -57
  756. package/typeclass/TraversableWithIndex.d.ts +9 -52
  757. package/typeclass/Witherable.d.ts +22 -82
  758. package/typeclass/WitherableWithIndex.d.ts +26 -98
  759. package/typeclass.d.ts +1 -0
  760. package/util/predicates.d.ts +1 -0
@@ -1,14 +1,17 @@
1
1
  import type * as P from "../../typeclass.js";
2
- import type { EitherF } from "./instances.js";
2
+ import type { EitherF } from "./definition.js";
3
3
 
4
4
  import { hasTypeId } from "../../util/predicates.js";
5
5
  import { identity } from "../function.js";
6
+ import { concrete } from "./definition.js";
6
7
  import { EitherTag, EitherTypeId, Left, Right } from "./definition.js";
7
8
 
8
9
  /**
9
10
  * @tsplus fluent fncts.Either ap
10
11
  */
11
12
  export function ap_<E1, A, E2, B>(self: Either<E1, (a: A) => B>, fa: Either<E2, A>): Either<E1 | E2, B> {
13
+ self.concrete();
14
+ fa.concrete();
12
15
  return self._tag === EitherTag.Left ? self : fa._tag === EitherTag.Left ? fa : Right(self.right(fa.right));
13
16
  }
14
17
 
@@ -16,6 +19,7 @@ export function ap_<E1, A, E2, B>(self: Either<E1, (a: A) => B>, fa: Either<E2,
16
19
  * @tsplus fluent fncts.Either bimap
17
20
  */
18
21
  export function bimap_<E1, A, E2, B>(self: Either<E1, A>, f: (e: E1) => E2, g: (a: A) => B): Either<E2, B> {
22
+ self.concrete();
19
23
  return self._tag === EitherTag.Left ? Left(f(self.left)) : Right(g(self.right));
20
24
  }
21
25
 
@@ -23,6 +27,7 @@ export function bimap_<E1, A, E2, B>(self: Either<E1, A>, f: (e: E1) => E2, g: (
23
27
  * @tsplus fluent fncts.Either catchAll
24
28
  */
25
29
  export function catchAll_<E1, A, E2, B>(self: Either<E1, A>, f: (e: E1) => Either<E2, B>): Either<E2, A | B> {
30
+ self.concrete();
26
31
  return self._tag === EitherTag.Left ? f(self.left) : self;
27
32
  }
28
33
 
@@ -47,6 +52,7 @@ export function catchMap_<E, A, B>(self: Either<E, A>, f: (e: E) => B): Either<n
47
52
  * @tsplus fluent fncts.Either flatMap
48
53
  */
49
54
  export function flatMap_<E1, A, E2, B>(self: Either<E1, A>, f: (a: A) => Either<E2, B>): Either<E1 | E2, B> {
55
+ self.concrete();
50
56
  return self._tag === EitherTag.Left ? self : f(self.right);
51
57
  }
52
58
 
@@ -54,6 +60,7 @@ export function flatMap_<E1, A, E2, B>(self: Either<E1, A>, f: (a: A) => Either<
54
60
  * @tsplus fluent fncts.Either foldLeft
55
61
  */
56
62
  export function foldLeft_<E, A, B>(self: Either<E, A>, b: B, f: (b: B, a: A) => B): B {
63
+ self.concrete();
57
64
  return self._tag === EitherTag.Left ? b : f(b, self.right);
58
65
  }
59
66
 
@@ -61,23 +68,16 @@ export function foldLeft_<E, A, B>(self: Either<E, A>, b: B, f: (b: B, a: A) =>
61
68
  * @tsplus fluent fncts.Either foldRight
62
69
  */
63
70
  export function foldRight_<E, A, B>(self: Either<E, A>, b: B, f: (a: A, b: B) => B): B {
71
+ self.concrete();
64
72
  return self._tag === EitherTag.Left ? b : f(self.right, b);
65
73
  }
66
74
 
67
75
  /**
68
- * @constrained
76
+ * @tsplus fluent fncts.Either foldMap
69
77
  */
70
- export function foldMap_<M>(M: P.Monoid<M>) {
71
- return <E, A>(self: Either<E, A>, f: (a: A) => M): M => (self._tag === EitherTag.Left ? M.nat : f(self.right));
72
- }
73
-
74
- /**
75
- * @tsplus getter fncts.Either foldMap
76
- */
77
- export function foldMapSelf<E, A>(self: Either<E, A>) {
78
- return <M>(M: P.Monoid<M>) =>
79
- (f: (a: A) => M): M =>
80
- foldMap_(M)(self, f);
78
+ export function foldMap_<E, A, M>(self: Either<E, A>, f: (a: A) => M, /** @tsplus auto */ M: P.Monoid<M>): M {
79
+ self.concrete();
80
+ return self._tag === EitherTag.Left ? M.nat : f(self.right);
81
81
  }
82
82
 
83
83
  /**
@@ -119,6 +119,7 @@ export function isEither(u: unknown): u is Either<unknown, unknown> {
119
119
  * @tsplus static fncts.EitherOps isLeft
120
120
  */
121
121
  export function isLeft<E, A>(self: Either<E, A>): self is Left<E> {
122
+ self.concrete();
122
123
  return self._tag === EitherTag.Left;
123
124
  }
124
125
 
@@ -127,6 +128,7 @@ export function isLeft<E, A>(self: Either<E, A>): self is Left<E> {
127
128
  * @tsplus static fncts.EitherOps isRight
128
129
  */
129
130
  export function isRight<E, A>(self: Either<E, A>): self is Right<A> {
131
+ self.concrete();
130
132
  return self._tag === EitherTag.Right;
131
133
  }
132
134
 
@@ -134,6 +136,7 @@ export function isRight<E, A>(self: Either<E, A>): self is Right<A> {
134
136
  * @tsplus fluent fncts.Either map
135
137
  */
136
138
  export function map_<E, A, B>(self: Either<E, A>, f: (a: A) => B): Either<E, B> {
139
+ self.concrete();
137
140
  return self._tag === EitherTag.Left ? self : Right(f(self.right));
138
141
  }
139
142
 
@@ -141,6 +144,7 @@ export function map_<E, A, B>(self: Either<E, A>, f: (a: A) => B): Either<E, B>
141
144
  * @tsplus fluent fncts.Either mapLeft
142
145
  */
143
146
  export function mapLeft_<E1, A, E2>(self: Either<E1, A>, f: (e: E1) => E2): Either<E2, A> {
147
+ self.concrete();
144
148
  return self._tag === EitherTag.Left ? Left(f(self.left)) : self;
145
149
  }
146
150
 
@@ -155,45 +159,96 @@ export function merge<E, A>(self: Either<E, A>): E | A {
155
159
  * @tsplus fluent fncts.Either orElse
156
160
  */
157
161
  export function orElse_<E1, A, E2, B>(self: Either<E1, A>, that: Lazy<Either<E2, B>>): Either<E1 | E2, A | B> {
162
+ self.concrete();
158
163
  return self._tag === EitherTag.Left ? that() : self;
159
164
  }
160
165
 
161
- export const sequence: P.sequence<EitherF> = (A) => (self) => traverse_(A)(self, identity);
162
-
163
- /**
164
- * @tsplus getter fncts.Either sequence
165
- */
166
- export const sequenceSelf: P.sequenceSelf<EitherF> = (self) => (A) =>
167
- unsafeCoerce(traverse_(A)(self, unsafeCoerce(identity)));
168
-
169
166
  /**
170
167
  * @tsplus getter fncts.Either swap
171
168
  */
172
169
  export function swap<E, A>(self: Either<E, A>): Either<A, E> {
170
+ self.concrete();
173
171
  return self._tag === EitherTag.Left ? Right(self.left) : Left(self.right);
174
172
  }
175
173
 
176
- export const traverse_: P.traverse_<EitherF> = (A) => (self, f) =>
174
+ /**
175
+ * @tsplus fluent fncts.Either traverse
176
+ */
177
+ export const traverse_: P.Traversable<EitherF>["traverse"] = (self, f, A) =>
177
178
  self.match(
178
179
  (e) => A.pure(Left(e)),
179
- (a) => f(a).via(A.map((b) => Right(b))),
180
+ (a) => f(a).map((b) => Right(b), A),
180
181
  );
181
182
 
182
- export const traverse: P.traverse<EitherF> = (A) => (f) => (self) => traverse_(A)(self, f);
183
-
184
- /**
185
- * @tsplus getter fncts.Either traverse
186
- */
187
- export const traverseSelf: P.traverseSelf<EitherF> = (self) => (A) => (f) => traverse_(A)(self, f);
188
-
189
183
  export function zipWith_<E1, A, E2, B, C>(
190
184
  self: Either<E1, A>,
191
185
  fb: Either<E2, B>,
192
186
  f: (a: A, b: B) => C,
193
187
  ): Either<E1 | E2, C> {
188
+ self.concrete();
189
+ fb.concrete();
194
190
  return self._tag === EitherTag.Left ? self : fb._tag === EitherTag.Left ? fb : Right(f(self.right, fb.right));
195
191
  }
196
192
 
193
+ /**
194
+ * @tsplus fluent fncts.Either filterMap
195
+ */
196
+ export function filterMap<E, A, B>(
197
+ self: Either<E, A>,
198
+ f: (a: A) => Maybe<B>,
199
+ /** @tsplus auto */ M: P.Monoid<E>,
200
+ ): Either<E, B> {
201
+ self.concrete();
202
+ return self._tag === EitherTag.Left
203
+ ? self
204
+ : f(self.right).match(
205
+ () => Left(M.nat),
206
+ (b) => Right(b),
207
+ );
208
+ }
209
+
210
+ /**
211
+ * @tsplus fluent fncts.Either filter
212
+ */
213
+ export function filter<E, A>(self: Either<E, A>, f: Predicate<A>, /** @tsplus auto */ M: P.Monoid<E>): Either<E, A> {
214
+ self.concrete();
215
+ return self._tag === EitherTag.Left ? self : f(self.right) ? self : Left(M.nat);
216
+ }
217
+
218
+ /**
219
+ * @tsplus fluent fncts.Either partitionMap
220
+ */
221
+ export function partitionMap<E, A, B, C>(
222
+ self: Either<E, A>,
223
+ f: (a: A) => Either<B, C>,
224
+ /** @tsplus auto */ M: P.Monoid<E>,
225
+ ): readonly [Either<E, B>, Either<E, C>] {
226
+ self.concrete();
227
+ if (self._tag === EitherTag.Left) {
228
+ return [self, self];
229
+ }
230
+ const fb: Either<B, C> = f(self.right);
231
+ fb.concrete();
232
+ switch (fb._tag) {
233
+ case EitherTag.Left:
234
+ return [Right(fb.left), Left(M.nat)];
235
+ case EitherTag.Right:
236
+ return [Left(M.nat), fb];
237
+ }
238
+ }
239
+
240
+ /**
241
+ * @tsplus fluent fncts.Either partition
242
+ */
243
+ export function partition<E, A>(
244
+ self: Either<E, A>,
245
+ p: Predicate<A>,
246
+ /** @tsplus auto */ M: P.Monoid<E>,
247
+ ): readonly [Either<E, A>, Either<E, A>] {
248
+ self.concrete();
249
+ return self._tag === EitherTag.Left ? [self, self] : p(self.right) ? [Left(M.nat), self] : [self, Left(M.nat)];
250
+ }
251
+
197
252
  // codegen:start { preset: barrel, include: api/*.ts }
198
253
  export * from "./api/align.js";
199
254
  export * from "./api/alignWith.js";
@@ -6,37 +6,50 @@ export const enum EitherTag {
6
6
  export const EitherTypeId = Symbol.for("fncts.base.data.Either");
7
7
  export type EitherTypeId = typeof EitherTypeId;
8
8
 
9
+ export interface EitherF extends Either<any, any> {}
10
+ export interface Either1F<E> extends Either1<E, any> {}
11
+
9
12
  /**
10
- * @tsplus type fncts.Either.Left
11
- * @tsplus companion fncts.Either.LeftOps
13
+ * @tsplus type fncts.Either
14
+ * @tsplus companion fncts.EitherOps
12
15
  */
13
- export class Left<E> {
16
+ export class Either<E, A> {
14
17
  readonly _typeId: EitherTypeId = EitherTypeId;
15
- readonly _tag = EitherTag.Left;
16
- constructor(readonly left: E) {}
18
+ readonly [HKT.F]!: EitherF;
19
+ readonly [HKT.E]!: () => E;
20
+ readonly [HKT.A]!: () => A;
21
+ readonly [HKT.T]!: Either<HKT._E<this>, HKT._A<this>>;
17
22
  }
18
23
 
19
- /**
20
- * @tsplus type fncts.Either.Right
21
- * @tsplus companion fncts.Either.RightOps
22
- */
23
- export class Right<A> {
24
- readonly _typeId: EitherTypeId = EitherTypeId;
25
- readonly _tag = EitherTag.Right;
26
- constructor(readonly right: A) {}
24
+ export interface Either1<E, A> {
25
+ readonly _typeId: EitherTypeId;
26
+ readonly [HKT.F]: EitherF;
27
+ readonly [HKT.E]: () => E;
28
+ readonly [HKT.A]: () => A;
29
+ readonly [HKT.T]: Either<E, HKT._A<this>>;
27
30
  }
28
31
 
29
32
  /**
30
- * @tsplus type fncts.Either
33
+ * @tsplus type fncts.Either.Left
34
+ * @tsplus companion fncts.Either.LeftOps
31
35
  */
32
- export type Either<E, A> = Left<E> | Right<A>;
36
+ export class Left<E> extends Either<E, never> {
37
+ readonly _tag = EitherTag.Left;
38
+ constructor(readonly left: E) {
39
+ super();
40
+ }
41
+ }
33
42
 
34
43
  /**
35
- * @tsplus type fncts.EitherOps
44
+ * @tsplus type fncts.Either.Right
45
+ * @tsplus companion fncts.Either.RightOps
36
46
  */
37
- export interface EitherOps {}
38
-
39
- export const Either: EitherOps = {};
47
+ export class Right<A> extends Either<never, A> {
48
+ readonly _tag = EitherTag.Right;
49
+ constructor(readonly right: A) {
50
+ super();
51
+ }
52
+ }
40
53
 
41
54
  /**
42
55
  * @tsplus unify fncts.Either
@@ -46,3 +59,12 @@ export function unifyEither<X extends Either<any, any>>(
46
59
  ): Either<[X] extends [Either<infer E, any>] ? E : never, [X] extends [Either<any, infer A>] ? A : never> {
47
60
  return self;
48
61
  }
62
+
63
+ /**
64
+ * @tsplus fluent fncts.Either concrete
65
+ * @tsplus static fncts.EitherOps concrete
66
+ * @tsplus macro remove
67
+ */
68
+ export function concrete<E, A>(self: Either<E, A>): asserts self is Left<E> | Right<A> {
69
+ //
70
+ }
@@ -4,6 +4,7 @@ import { EitherTag } from "./definition.js";
4
4
  * @tsplus fluent fncts.Either match
5
5
  */
6
6
  export function match_<E, A, B, C>(self: Either<E, A>, left: (e: E) => B, right: (a: A) => C): B | C {
7
+ self.concrete();
7
8
  switch (self._tag) {
8
9
  case EitherTag.Left:
9
10
  return left(self.left);
@@ -1,80 +1,131 @@
1
+ import type { Either1F, EitherF } from "@fncts/base/data/Either/definition.js";
2
+
3
+ import { map_ } from "@fncts/base/data/Either/api";
4
+ import { concrete, Either, EitherTag, Right } from "@fncts/base/data/Either/definition";
5
+ import { EitherJson } from "@fncts/base/json/EitherJson";
6
+
1
7
  import * as P from "../../typeclass.js";
2
- import { map_ } from "./api.js";
3
- import { EitherTag, Left, Right } from "./definition.js";
4
8
 
5
- export interface EitherF extends HKT {
6
- readonly type: Either<this["E"], this["A"]>;
7
- readonly variance: {
8
- E: "+";
9
- A: "+";
10
- };
11
- }
9
+ /**
10
+ * @tsplus implicit
11
+ */
12
+ export const Functor: P.Functor<EitherF> = {
13
+ map: map_,
14
+ };
12
15
 
13
16
  /**
14
17
  * @tsplus static fncts.EitherOps getEq
15
18
  */
16
19
  export function getEq<E, A>(EE: P.Eq<E>, EA: P.Eq<A>): P.Eq<Either<E, A>> {
17
20
  return P.Eq({
18
- equals_: (x, y) =>
21
+ equals: (x, y) =>
19
22
  x === y ||
20
23
  x.match(
21
24
  (e1) =>
22
25
  y.match(
23
- (e2) => EE.equals_(e1, e2),
26
+ (e2) => EE.equals(e1, e2),
24
27
  () => false,
25
28
  ),
26
29
  (a1) =>
27
30
  y.match(
28
31
  () => false,
29
- (a2) => EA.equals_(a1, a2),
32
+ (a2) => EA.equals(a1, a2),
30
33
  ),
31
34
  ),
32
35
  });
33
36
  }
34
37
 
35
38
  /**
36
- * @tsplus static fncts.EitherOps getEq
39
+ * @tsplus derive fncts.Eq[fncts.Either]<_> 10
37
40
  */
38
- export function getFilerable<E>(ME: P.Monoid<E>) {
39
- type FixE = HKT.Fix<"E", E>;
40
-
41
- const empty = Left(ME.nat);
41
+ export function deriveEq<A extends Either<any, any>>(
42
+ ...[left, right]: [A] extends [Either<infer E, infer A>] ? [left: P.Eq<E>, right: P.Eq<A>] : never
43
+ ): P.Eq<A> {
44
+ return Either.getEq(left, right);
45
+ }
42
46
 
43
- const partitionMap_: P.partitionMap_<EitherF, FixE> = (fa, f) => {
44
- if (fa._tag === EitherTag.Left) {
45
- return [fa, fa];
46
- }
47
- const fb = f(fa.right);
48
- switch (fb._tag) {
49
- case EitherTag.Left:
50
- return [Right(fb.left), empty];
51
- case EitherTag.Right:
52
- return [empty, fb];
53
- }
47
+ /**
48
+ * @tsplus static fncts.EitherOps getFilterable
49
+ */
50
+ export function getFilerable<E>(/** @tsplus auto */ ME: P.Monoid<E>): P.Filterable<Either1F<E>> {
51
+ return <P.Filterable<Either1F<E>>>{
52
+ ...Functor,
53
+ partitionMap: (fa, f) => {
54
+ concrete(fa);
55
+ if (fa._tag === EitherTag.Left) {
56
+ return [fa, fa];
57
+ }
58
+ const fb = f(fa.right);
59
+ concrete(fb);
60
+ switch (fb._tag) {
61
+ case EitherTag.Left:
62
+ return [Right(fb.left), Either.left(ME.nat)];
63
+ case EitherTag.Right:
64
+ return [Either.left(ME.nat), fb];
65
+ }
66
+ },
67
+ filter: <A>(fa: Either<E, A>, p: Predicate<A>) => {
68
+ concrete(fa);
69
+ switch (fa._tag) {
70
+ case EitherTag.Left:
71
+ return fa;
72
+ case EitherTag.Right:
73
+ return p(fa.right) ? fa : Either.left(ME.nat);
74
+ }
75
+ },
76
+ filterMap: (fa, f) => {
77
+ concrete(fa);
78
+ if (fa._tag === EitherTag.Left) {
79
+ return fa;
80
+ }
81
+ return f(fa.right).match(
82
+ () => Either.left(ME.nat),
83
+ (b) => Either.right(b),
84
+ );
85
+ },
86
+ partition: <A>(fa: Either<E, A>, p: Predicate<A>): readonly [Either<E, A>, Either<E, A>] => {
87
+ concrete(fa);
88
+ if (fa._tag === EitherTag.Left) {
89
+ return [fa, fa];
90
+ }
91
+ return p(fa.right) ? [Either.left(ME.nat), fa] : [fa, Either.left(ME.nat)];
92
+ },
54
93
  };
94
+ }
55
95
 
56
- const partition_: P.partition_<EitherF, FixE> = <A>(
57
- fa: Either<E, A>,
58
- p: Predicate<A>,
59
- ): readonly [Either<E, A>, Either<E, A>] =>
60
- fa._tag === EitherTag.Left ? [fa, fa] : p(fa.right) ? [empty, fa] : [fa, empty];
61
-
62
- const filterMap_: P.filterMap_<EitherF, FixE> = (fa, f) =>
63
- fa._tag === EitherTag.Left
64
- ? fa
65
- : f(fa.right).match(
66
- () => empty,
67
- (b) => Right(b),
68
- );
69
-
70
- const filter_: P.filter_<EitherF, FixE> = <A>(fa: Either<E, A>, p: Predicate<A>): Either<E, A> =>
71
- fa._tag === EitherTag.Left ? fa : p(fa.right) ? fa : empty;
72
-
73
- return P.Filterable<EitherF, FixE>({
74
- map_,
75
- filter_,
76
- filterMap_,
77
- partition_,
78
- partitionMap_,
96
+ /**
97
+ * @tsplus derive fncts.Guard[fncts.Either]<_> 10
98
+ */
99
+ export function deriveGuard<A extends Either<any, any>>(
100
+ ...[left, right]: [A] extends [Either<infer E, infer A>] ? [left: Guard<E>, right: Guard<A>] : never
101
+ ): Guard<A> {
102
+ return Guard((u): u is A => {
103
+ if (Either.isEither(u)) {
104
+ if (u.isLeft()) {
105
+ return left.is(u.left);
106
+ }
107
+ if (u.isRight()) {
108
+ return right.is(u.right);
109
+ }
110
+ }
111
+ return false;
79
112
  });
80
113
  }
114
+
115
+ /**
116
+ * @tsplus derive fncts.Decoder[fncts.Either]<_> 10
117
+ */
118
+ export function deriveDecoder<A extends Either<any, any>>(
119
+ ...[left, right]: [A] extends [Either<infer E, infer A>] ? [left: Decoder<E>, right: Decoder<A>] : never
120
+ ): Decoder<A> {
121
+ const jsonDecoder = EitherJson.getDecoder(left, right);
122
+ return Decoder(
123
+ (u) =>
124
+ jsonDecoder
125
+ .decode(u)
126
+ .map((result) =>
127
+ result._tag === "Left" ? (Either.left(result.left) as A) : (Either.right(result.right) as A),
128
+ ),
129
+ `Either<${left.label}, ${right.label}>`,
130
+ );
131
+ }
@@ -2,7 +2,8 @@
2
2
  * @tsplus fluent fncts.Environment add
3
3
  */
4
4
  export function add<R, S, H extends S = S>(self: Environment<R>, service: H, tag: Tag<S>): Environment<R & Has<S>> {
5
- return new Environment(self.map.set(tag, [service, self.index]), self.index + 1);
5
+ const self0 = self.index === Number.MAX_SAFE_INTEGER ? self.clean : self;
6
+ return new Environment(self0.map.set(tag, [service, self0.index]), self0.index + 1);
6
7
  }
7
8
 
8
9
  /**
@@ -36,12 +37,27 @@ export function make(): Environment<unknown> {
36
37
  * @tsplus fluent fncts.Environment union
37
38
  */
38
39
  export function union<R, R1>(self: Environment<R>, that: Environment<R1>): Environment<R & R1> {
40
+ const [self0, that0] = self.index + that.index < self.index ? [self.clean, that.clean] : [self, that];
39
41
  return new Environment(
40
- self.map.union(that.map.map(([service, index]) => [service, self.index + index] as const)),
41
- self.index + that.index,
42
+ self0.map.union(that0.map.map(([service, index]) => [service, self0.index + index] as const)),
43
+ self0.index + that0.index,
42
44
  );
43
45
  }
44
46
 
47
+ /**
48
+ * @tsplus getter fncts.Environment clean
49
+ */
50
+ export function clean<R>(self: Environment<R>): Environment<R> {
51
+ const [map, index] = self.map.toList
52
+ .sort(Number.Ord.contramap(([, [, idx]]) => idx))
53
+ .foldLeft(
54
+ [HashMap.makeDefault<Tag<unknown>, readonly [unknown, number]>(), 0],
55
+ ([map, index], [tag, [service]]) => [map.set(tag, [service, index] as const), index + 1],
56
+ );
57
+
58
+ return new Environment(map, index);
59
+ }
60
+
45
61
  /**
46
62
  * @tsplus fluent fncts.Environment unsafeGet
47
63
  */
@@ -67,7 +83,6 @@ export function unsafeGet<R, S>(self: Environment<R>, tag: Tag<S>): S {
67
83
  },
68
84
  (a) => a as S,
69
85
  );
70
- // return self.cache.unsafeGet(tag) as S;
71
86
  }
72
87
 
73
88
  /**
@@ -2,14 +2,14 @@
2
2
  * @tsplus fluent fncts.Identity ap
3
3
  */
4
4
  export function ap_<A, B>(fab: Identity<(a: A) => B>, fa: Identity<A>): Identity<B> {
5
- return fab(fa);
5
+ return Identity.get(Identity.reverseGet(fab)(Identity.reverseGet(fa)));
6
6
  }
7
7
 
8
8
  /**
9
9
  * @tsplus fluent fncts.Identity map
10
10
  */
11
11
  export function map_<A, B>(fa: Identity<A>, f: (a: A) => B): Identity<B> {
12
- return f(fa);
12
+ return Identity.get(f(Identity.reverseGet(fa)));
13
13
  }
14
14
 
15
15
  /**
@@ -17,12 +17,27 @@ export function map_<A, B>(fa: Identity<A>, f: (a: A) => B): Identity<B> {
17
17
  * @tsplus static fncts.IdentityOps __call
18
18
  */
19
19
  export function pure<A>(a: A): Identity<A> {
20
- return a;
20
+ return Identity.get(a);
21
21
  }
22
22
 
23
23
  /**
24
24
  * @tsplus fluent fncts.Identity zipWith
25
25
  */
26
26
  export function zipWith_<A, B, C>(fa: Identity<A>, fb: Identity<B>, f: (a: A, b: B) => C): Identity<C> {
27
- return f(fa, fb);
27
+ return Identity.get(f(Identity.reverseGet(fa), Identity.reverseGet(fb)));
28
28
  }
29
+
30
+ /**
31
+ * @tsplus fluent fncts.Identity zip
32
+ */
33
+ export function zip_<A, B>(fa: Identity<A>, fb: Identity<B>): Identity<readonly [A, B]> {
34
+ return fa.zipWith(fb, (a, b) => [a, b]);
35
+ }
36
+
37
+ /**
38
+ * @tsplus getter fncts.Identity getIdentity
39
+ * @tsplus macro identity
40
+ */
41
+ export function getIdentity<A>(self: Identity<A>): A {
42
+ return Identity.reverseGet(self);
43
+ }
@@ -1,11 +1,15 @@
1
+ export interface IdentityN {
2
+ readonly [HKT.T]: Identity<HKT._A<this>>
3
+ }
4
+
1
5
  /**
2
6
  * @tsplus type fncts.Identity
3
7
  */
4
- export type Identity<A> = A;
8
+ export interface Identity<A> extends Newtype<"Identity", A> {}
5
9
 
6
10
  /**
7
11
  * @tsplus type fncts.IdentityOps
8
12
  */
9
- export interface IdentityOps {}
13
+ export interface IdentityOps extends NewtypeIso<IdentityN> {}
10
14
 
11
- export const Identity: IdentityOps = {};
15
+ export const Identity: IdentityOps = Newtype<IdentityN>();
@@ -1,21 +1,28 @@
1
- import * as P from "../../typeclass.js";
2
- import { ap_, map_, pure, zipWith_ } from "./api.js";
1
+ import type * as P from "../../typeclass.js";
2
+ import type { IdentityN } from "@fncts/base/data/Identity/definition";
3
3
 
4
- export interface IdentityF extends HKT {
5
- readonly type: Identity<this["A"]>;
6
- }
4
+ import { ap_, map_, pure, zip_, zipWith_ } from "./api.js";
7
5
 
8
6
  /**
9
7
  * @tsplus static fncts.IdentityOps Functor
10
8
  */
11
- export const Functor = P.Functor<IdentityF>({ map_ });
9
+ export const Functor: P.Functor<IdentityN> = {
10
+ map: map_,
11
+ };
12
12
 
13
13
  /**
14
14
  * @tsplus static fncts.IdentityOps Apply
15
15
  */
16
- export const Apply = P.Apply<IdentityF>({ map_, ap_, zipWith_ });
16
+ export const Apply: P.Apply<IdentityN> = {
17
+ ...Functor,
18
+ zip: zip_,
19
+ zipWith: zipWith_,
20
+ };
17
21
 
18
22
  /**
19
23
  * @tsplus static fncts.IdentityOps Applicative
20
24
  */
21
- export const Applicative = P.Applicative<IdentityF>({ map_, ap_, zipWith_, pure });
25
+ export const Applicative: P.Applicative<IdentityN> = {
26
+ ...Apply,
27
+ pure,
28
+ };