Hacker News new | ask | show | jobs
by mmoll 992 days 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);