simon.vergauwen
09/29/2022, 10:23 AMraulraja
09/29/2022, 11:12 AMfoldMap
is going away presumably because working with Monoid or type classes is a pain, should we also get rid of Monoid etc? or are those still useful for other things?simon.vergauwen
09/29/2022, 11:15 AMMonoid
and Semigroup
still offer a lot of value. Semigroup
is a glorified (A, A) -> A
function, and similar for Monoid
.
Working with Iterable
and data types is simplified a lot with the new APIs.
traverse
is map
+ bind
, and accumulating is mapAccumulating { either() }
.
That would be outside of the scope of this PR, but absolutely something we can consider for 2.0 (and deprecation in 1.x.x)thanh
09/30/2022, 6:41 AMSatyam Agarwal
09/30/2022, 9:42 AMraulraja
09/30/2022, 9:50 AMNonEmptyList
, but since by default error accumulation happens in a non-empty list and how to combine non-empty list (their semigroup) is known, we don't need that extra semigroup param or expose it to users.raulraja
09/30/2022, 10:00 AMBut is my understanding wrong ?I think it's right, we are getting rid of Validated and error accumulation will happen naturally without having to provide a semigroup.
simon.vergauwen
09/30/2022, 10:21 AMEither<E, A>.zip(other: Either<E, B>, combine: (E, E) -> E, transform: (A, B) -> C): Either<E, C>
Either<E, A>.zip(other: Either<E, B>, transform: (A, B) -> C): Either<Nel<E>, C>
Iterable<A>.mapAccumulating(combine: (E, E) -> E, transform: (A) -> Either<E, B>): Either<E, List<B>>
Iterable<A>.mapAccumulating(transform: (A) -> Either<E, B>): Either<Nel<E>, List<B>>
The new either
DSL will be inline
so no more need for eager
or invoke
and you can just add suspend
wherever needed ad-hoc. Using the DSL will have the same cost as a single map
, so it can be used everywhere without any performance hits.Satyam Agarwal
09/30/2022, 2:49 PM