You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Either#fold has one parameter list,def fold[C](fa: A => C, fb: B => C): C
but Option#fold has two, def fold[B](ifEmpty: => B)(f: A => B): B
as shown in #9262, the single-parameter-list version offers better type inference
it's also simply confusing that the two are different
fwiw, the difference goes away in Dotty, which can infer the right type either way:
scala> Option(5).fold(Left("err"))(Right(_))
val res0: scala.util.Either[String, Int] = Right(5)
given that the improvement in type inference is coming in Dotty, it might still be worth bringing the two in line for consistency's sake? I fear it's not worth breaking existing code