Applicative do-notation

April 06, 2016

import Control.Monad (ap)
hello :: Maybe String
hello = (++) <$> (Just "Hello, ") <*> (Just "world!")
hello' :: Maybe String
hello' = do
  f <- Just (++)
  x <- Just "Hello, "
  y <- Just "world!"
  return $ f x y
main :: IO ()
main = do
  putStrLn $ show hello