Why don't they add a new interface which will essentially be Monad? Is the polymorphism story in C++ not good enough for practical use of it?
Also, the type system in C++, despite all the template stuff, is not actually very good for serious functional programming. For example, when taking a function, there is no generic way to specify its signature in your own signature (and no, taking a std::function is not generic). `require` goes a long way though nowadays.
template <typename T> requires std::invokable_r_v<int,int,int> int foo(T fn){ return fn(10, 20); }
But I think you wanted to show a different example.
And yes the inline version rather than requires is much nicer.