
10 Mar
2008
10 Mar
'08
6:48 p.m.
Am Montag, 10. März 2008 23:34 schrieb Alfonso Acosta:
On Mon, Mar 10, 2008 at 11:11 PM, Paulo J. Matos
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)
But print is (putStrLn . show), so what may be missing is (putStr . show).