In [1]:
-- let see the putStrln type
:t putStrLn
In [2]:
-- the type of getLine
:t getLine
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])
In [6]:
-- equal above
mapM print [1,2,3]
In [7]:
mapM_ print [1,2,3]
In [8]:
import Control.Monad
In [9]:
inut <- getLine
In [10]:
input = "hello wrold"
putStrLn input
In [11]:
return ()