Ussage of the opposite of and_then()
badumbatish opened this issue · 0 comments
badumbatish commented
Hi there, thank you for your library. I have a question about the library.
If I want to continue the chain of the function call in case the first one doesn't succeed, how should i do it?
For example, i have a bunch of function that takes in a type A
and spits out tl::expected<A, std::string>
Is there a way to do
XYZ.and_then(function_A).or(function_B).or(function_C) ?
in case that if function A doesn't succeed, I want function B to be executed and if function B doesn't succeed, i want function C to be executed and etc etc
Edit: i think this is a bit weird why I would want this. Ill close the issue now.