4 ms·
The Maybe Monad
by Y_Y 4y ago
The Maybe Monad
- btown 4y agoYep, and monads without syntactic support are a pain to work with in practice! For instance, the best possible way in a language like Python is to break down what would otherwise be a set of imperative statements into a whole bunch of lambda functions: https://returns.readthedocs.io/en/latest/#id1 https://returns.readthedocs.io/en/latest/#id1
- loeg 4y agoIn a C++ code base I work on, we use a macro that is essentially Rust’s ?. It’s obviously less convenient than ?, but it’s not bad (even without syntax support). In the past in systems C code, I’ve manually written every error check and return.