In [1]:
-- let see the putStrln type
:t putStrLn


putStrLn :: String -> IO ()

In [2]:
-- the type of getLine
:t getLine


getLine :: IO String

In [4]:
-- putStr come from putChar
putStr :: String -> IO ()
putStr [] = return ()
putStr (x:xs) = do
    putChar x
    putStr xs

In [5]:
-- sequence with map
sequence (map print [1, 2, 3, 4, 5])


Use mapM
Found:
sequence (map print [1, 2, 3, 4, 5])
Why Not:
mapM print [1, 2, 3, 4, 5]
1
2
3
4
5
[(),(),(),(),()]

In [6]:
-- equal above
mapM print [1,2,3]


1
2
3
[(),(),()]

In [7]:
mapM_ print [1,2,3]


1
2
3

In [8]:
import Control.Monad

In [9]:
inut <- getLine


: hGetLine: end of file

In [10]:
input = "hello wrold"
putStrLn input


hello wrold

In [11]:
return ()