Convert a “do” notation with more than two actions to use the bind function
问题 I know that the following "do" notation's "bind" function is equivalent to getLine >>= \line -> putStrLn do line <- getLine putStrLn line But how is the following notation equivalent to bind function? do line1 <- getLine putStrLn "enter second line" line2 <- getLine return (line1,line2) 回答1: I take it you are trying to see how to bind the result of "putStrLn". The answer is in the type of putStrLn: putStrLn :: String -> IO () Remember that "()" is the unit type, which has a single value (also