Understanding liftM2 in haskell

haskell, io

Solution

I don't think the compiler can parse this without spaces around `$` . Then, here main would have type IO (IO ())

If you want to sum "inside" IO, you can use `liftM2 (+)`, then print the result.

For example :

main :: IO ()
main = print =<< liftM2 (+) readLn readLn

Or using do notation :

main :: IO ()
main = do
  s <- liftM2 (+) readLn readLn
  print s

Problem

I'm having a hard time understanding how `liftM2` works in haskell. I wrote the following code but it doesn't output anything. ``` import Control.Monad main = liftM2 (\a b -> putStrLn$show$(+) a b) readLn readLn ```

Original source