A question was asked as: "
Why Either = Left | Right instead of something like Result = Success | Failure" This was interesting in the answers:
Either is a generic sum type. That is, "Either A B" only means "either you have an A, or you have a B". Use of Left to represent failure is merely a matter of convention. Similarly, the generic product type in Haskell is the 2-tuple--"(A, B)" only means "you have both an A and a B".
No comments:
Post a Comment