Safe and Readable Code: Monadic Operations in C++23
Robert Schimkowitsch
16:00-17:30, Tuesday, 1st April 2025
Let's talk about monads. What are they? Why and how would you use them?
The aim of this talk is to introduce some fundamental functional programming techniques (such as monads) and explain how they make your code safer and more readable. Using C++20 and 23 additions, multiple classic condition- and loop-based code examples are transformed into a more functional, declarative form. The resulting code is less complex, has less duplication and a lower likelihood of containing bugs.
The talk is intended for anyone who would like to learn about functional programming techniques and add new tools to their code design toolbox. After it, you will
- Have an idea what functors and monads are
- Know multiple ways to pass callables to them
- Confidently use std::views::transform and std::views::join, std::optional and std::expected
- Know about some some common pitfalls and how to avoid them
- Have the tools to write your own monadic wrapper
Being able to read basic C++ code is recommended.
Robert Schimkowitsch
Robert has been a professional application developer for 25 years, 15 of them using C++ and Qt. Working on long-lived software, he knows how to create code that is safe, reliable and easy to maintain (by first writing lots of code that was not). Always learning new things, Robert often feels the urge to throw away everything older than 3 years, but is (usually) smart enough not to do so. He enjoys working with others and likes to emphasize the social aspects of software development, as with the C++ User Group Vienna (Austria) that he co-founded.