> Some example for writing a text the IO oriented way:
 >   do putStrLn "bla"
 >      replicateM 5 (putStrLn "blub")
 >      putStrLn "end"
 >
 > whereas the lazy way is
 >   putStr (unlines (["bla"] ++ replicate 5 "blub" ++ ["end"]))

Um, maybe it's just me, but I think the first program is far
superior to the second one. The last thing you want your I/O
code to be is lazy. You want the exact opposite: you want it
to be as strict as possible. Not only does the second
version waste a lot of CPU time and memory for pointlessly
constructing a lazily evaluated list nobody ever needs, it
will also explode into your face the moment you use that
approach to write any non-trivial number of bytes.

Peter

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to