News for hackers. Stuff that matters.
Re:Elegant Error Handling with the JavaScript “Either” Monad by im3w1l on Wednesday June 19, 2019 @01:44PM (#20225370)
This sounds clever at the expense of readability. Creating an explicit fallback mechanism for a Result would imo be preferable.
Re:Elegant Error Handling with the JavaScript “Either” Monad by pwm on Wednesday June 19, 2019 @03:33PM (#20226554)
It's not clever for its own sake. Haskell is rooted in math and Either is logical disjunction. Its semantics is precisely that. Error handling is a specific use-case that can be implemented with Either. Rust as a language is more pragmatic. In real-world industrial code the concept of Either is predominantly used for error handling and thus Rust named their data constructors aptly.