6 ms·
But code using these monadic operations can also be quite clean… toy example: auto askForUsername = [&] { … }; auto lookupUserByName = [&](auto name) { …
by mmoll 3y ago
But code using these monadic operations can also be quite clean… toy example:
auto askForUsername = [&] { … };
auto lookupUserByName = [&](auto name) { … };
auto printUserDetails = [&](auto userId) { … };
auto details =
askForUsername()
.and_then(lookupUserByName)
.and_then(printUserDetails);
- deleted 3y ago[deleted]