C++ Error Handling Revisited
summary
Shows a working plant-watering example that compares Haskell’s Maybe/Either and do/bind patterns with Rust’s Option/Result and C++17 features, using std::optional, std::variant and std::visit then replacing them with a small custom result type and a C++ bind operator. The custom wrapper noticeably cuts boilerplate and keeps descriptive value-returning APIs; implementing do-notation in readable C++ remains unresolved, but the homemade result plus bind proves practical and surprisingly simple.
AI-written summary · about
chapters (13)
- 0:00Intro
- 2:18Example
- 4:05Patterns
- 8:04Haskell
- 9:33Error Handling
- 10:56Maybe
- 17:32Bind Operator
- 21:24Do Notation
- 29:40Rust
- 35:56Standard Optional
- 38:38Standard Variant
- 41:20Standard Visit
- 53:45Conclusion
related talks
57mAnd Then() Some(T) Functional Adventures With C++23 std::optional and std::expected
01h 22mRust for the C++ Programmer
44mError handling in C++: as easy as "use exceptions"?
20mAnd Then() Some(T): C++ Combinators - Higher-Order Functions in Cpp
01h 03mMonads in Modern C++
01h 03mHigher order functions for ordinary C++ developers
01h 31mFunctional Programming in Modern C++: The Imperatives Must Go!
01h 18mSafe and Readable C++ Code: Monadic Operations in C++23
