11 Mar
2008
11 Mar
'08
6:34 a.m.
On Mon, Mar 10, 2008 at 11:11 PM, Paulo J. Matos <pocm@soton.ac.uk> wrote:
outputLines i = mapM (putStrLn . show) (take i $ iterate ((+) 1) 1)
However, this is in fact outputLines :: Int -> IO [()]
As others suggested you can use mapM_ Furthermore, you can simplify it a bit with some syntactic sugar outputLines i = mapM_ (putStrLn . show) [1..i] BTW, considering how often is (putStrLn.show) used, it is surprising that there is no Ln variant for print (just like it happens with putStr and putStrLn)