|
|
|
|
|
by dons
4063 days ago
|
|
> First let us switch to Haskell for pseudocode as I don’t want to show you the C++ that is required for this. Hehe, but that's actual code. > we may go back to our C++14 code base and implement the ideas there. I’m not going to show you how this can be done here, as it requires some more boilerplate code to make the compiler happy – as usual. People are going to want to see the code, otherwise, what's the point? |
|
I'm playing around with what is now my second iteration of Monadic Bind and Kleisli Composition for boost::optional, which looks something like this right now:
Kleisli Composition can then be build with C++14's generic polymorphic lambdas exactly like the Haskell implementation does it: https://hackage.haskell.org/package/base-4.6.0.1/docs/src/Co...There are other articles on the web for Monads in C++, that probably do a better job at an actual implementation. Please see this as my personal playground code :)