DEV Community

Discussion on: Why I don't like Scala's "Either"

Collapse
 
mikegirkin profile image
Mikhail Girkin • Edited

I agree with the main point of the article - Either is not very explicit when expressing potential errors, and current usage is based solely on convention.
But I don't see any benefit of adding one more type that would be exactly the same as Either, except for naming.

Minor nitpick: for Result type you proposed, map should return Result[AA, B] to stay consistent with usual definition of functor and map function. If you would like to be able to convert to Option, the conventional name would be .toOption or .asOption.