Thanks for your feedback!
Yes, I’m aware.
bimap would be a special case of fold. I wouldn’t mind too much if I could do either of those:
val result: Either[String, Int] = either.fold(Left(_.toString), Right(_.toInt))
val result: Either[String, Int] = either.fold(Left(f(_)), Right(g(_)))
But having to write the full lambda is quite tedious IMO.
I think the upsides of having the method would outweigh the downsides since it’s just adding a single method, but I could be wrong.
bimap would make some code more elegant and readable, but I don’t think if it would make big difference overall. I’m not against it, though.
True, it’s not very often this is useful. Most likely that’s why it wasn’t brought up yet.
There’s strong push against adding new methods to collections, because typically we want all collections to share as much methods as possible, so adding method to one collection means adding it to all collections.
I also thought about whether it’s possible to add it to
Future (which are not collections either, but I assume the same principles apply), but it’s not a good idea IMO, as the first parameter would be
Throwable => Throwable (which is not really