Closed ptal closed 10 years ago
There is already the function make_expected_from_call
The user could always do
e.mbind([](E& e){ return make_expected_from_call([](){ return f(e); }));
This is cumbersome, maybe, an adaptor will be better e.mbind(catch_all(f));
See #42
Close regarding #42, it's good for me.
Expected can be viewed as interfacing between a monadic code and an exception-throwing code. It could be convenient to call a trait method when an exception is thrown inside fmap/mbind or then method. The default trait method would rethrow if the contained error type is not an exception_ptr.
Another possibility is to have different overload for the two possibilities, what do you think?