3 ms·
Using `Either` instead of `Option` would violate "Use the least complex approach that solves your problem". If all you need is represent an optional value, why
by incepted 11y ago
Using `Either` instead of `Option` would violate "Use the least complex approach that solves your problem".
If all you need is represent an optional value, why use `Either`, which needs a second type parameter representing the failure? If you don't care about what caused the failure (because there was no failure, an absence of value is a valid result), no need to represent it.
Besides, these two classes still represent fundamentally different concepts and they are not interchangeable at all.
- AdieuToLogic 11y agoMy question was implicitly framed in the context of the "Error Handling" section of the paper. I agree that Option is an ideal choice for 0/1 cardinality situations and use if frequently for that purpose. Sorry for any confusion I may have introduced when re-stating the question originally posed by "Joe Clueless" in the comments section.