Challenge 2: The Same Chain, Written With do-Notation — Possible Solution ==================================================================== Main.hs: findUser :: Int -> Maybe String findUser 5 = Just "alice@example.com" findUser _ = Nothing findOrderByEmail :: String -> Maybe String findOrderByEmail "alice@example.com" = Just "Order #42" findOrderByEmail _ = Nothing findRecentOrderDo :: Int -> Maybe String findRecentOrderDo userId = do email <- findUser userId order <- findOrderByEmail email return order main :: IO () main = do print (findRecentOrderDo 5) print (findRecentOrderDo 99) Output: Just "Order #42" Nothing Explanation: findRecentOrderDo produces IDENTICAL results to Challenge 1's >>= chain for both inputs, because do-notation is pure syntax sugar over exactly that same >>= chain -- `email <- findUser userId` desugars to `findUser userId >>= \email -> ...`, and the whole do block desugars to the same nested >>= expression Challenge 1 wrote by hand. Nothing about the underlying behavior changed; only the surface syntax did. WHY THIS WORKS AS AN ANSWER ------------------------------ This rewrites Challenge 1's exact scenario using do-notation and confirms both the success and failure cases produce identical results to the explicit >>= version, directly demonstrating the chapter's own "do-notation is pure sugar over >>=" claim.