For some reason, Option.fold is curried but Either.fold is not. All in all, I prefer the way Either does, it makes it so much more natural to use named arguments to disambiguate the call
-
-
I’m mostly complaining about the lack of consistency between Either and Option though. There might be a good reason for ir, but I don’t really see it. Surely if it’s good to help type inference for one, it should also be for the other?
-
I'm not sure the inference ever helps in this case, anyway. But I suspect that the inconsistency comes from the fact Option is structurally asymmetrical, whereas Either was designed to be unbiased (but became such as an afterthought).
- Show replies
New conversation -
-
-
How does the type inference change in Scala 3 for this case?
-
Scala 3 will not fix the type of the default case as the most precise type which confirms to the parameter value. It will retain a range of types which can be further refined by the return type of the second parameter. It fixes the type only lazily.
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.