julian
01/07/2022, 12:32 AMEither.bifoldMap
take a Monoid
argument, when the monoid basically does no work, since bifoldMap
always combines the mapped values of the Either
with empty
, where the result of that combination is know ahead of time to always be the same as the mapped values. In other words, why jump through the hoop of combining a value with empty
, when we know the result will always be the same original value?julian
01/07/2022, 12:34 AMbifoldMap
can build on top of bifoldLeft
. Is that it?Scott Christopher
01/07/2022, 1:03 AMbifoldMap
was previously part of a typeclass that has since been removed from Arrow, which needed the monoid instance to be general for other "bifoldable" types like tuples. Now that it is specialised to Either
, I can't see any need for it.julian
01/07/2022, 2:50 AMMonad
and simplify `bifoldMap`s signature. Thanks @Scott Christopher.raulraja
01/08/2022, 5:15 PMempty
in bifoldmap. it’s kind of hidden because it’s achieved through run
, but when below we use combine
, that is syntax that is projected by the monoid receiver. I order to replace this monoid here we would have to provide both an empty operation and associate combine operation. https://github.com/arrow-kt/arrow/blob/b4714662adcd321cc8a03d01ff86da8fb187f406/ar[…]libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Either.kt
julian
01/08/2022, 5:20 PMcombine
at all? Since we know ahead of time that for any type C
, MN.empty().combine(f(a))
== f(a)
.raulraja
01/08/2022, 5:28 PMraulraja
01/08/2022, 5:30 PMjulian
01/08/2022, 5:31 PMraulraja
01/08/2022, 5:32 PMjulian
01/08/2022, 5:32 PM