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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I agree with the main point of the article -
Eitheris 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
Resulttype you proposed,mapshould returnResult[AA, B]to stay consistent with usual definition of functor andmapfunction. If you would like to be able to convert toOption, the conventional name would be.toOptionor.asOption.