[Haskell-beginners] Monad operators: multiple parameters

Christopher Howard christopher.howard at frigidcode.com
Tue Jun 7 14:30:29 CEST 2011

In a reply to an earlier question, someone told me that "do" expressions
are simply syntactic sugar that expand to expressions with the >> and
>>= operators. I was trying to understand this (and the Monad class) better.

I see in my own experiments that this...

main = do ln1 <- getLine
          putStrLn ln1

translates to this:

main = getLine >>= \ln1 -> putStrLn ln1

However, what does this translate to?:

main = do ln1 <- getLine
          ln2 <- getLine
          putStrLn (ln1 ++ ln2)


More information about the Beginners mailing list