
Hi, Am Mittwoch, den 09.11.2011, 20:33 -0500 schrieb Edward Kmett:
On Wed, Nov 9, 2011 at 5:38 PM, Joachim Breitner
wrote: I very much like the lazy O in lazy IO, e.g. with this real-life code line: hPutStrLn stderr $ "Out of " ++ show (IxS.size (binaries unstable `IxS.union` binaries testing)) ++ " binary packages, " ++ show (IxS.size unmod) ++ " are unmodified, but " ++ show (IxS.size affected) ++ " are possibly affected."
Thanks to lazy IO, I get a very nice feedback about what the code is doing right now, and how long the various values take to calculate.
I fail to see what is lazy about this O. It looks like regular O to me. =)
When it is run, it will print Out of then wait for a while, then print a number and the next text Out of 123455 binary packages, then wait for a while, the print the next number Out of 123455 binary packages, 4223 are unmodified, but then wait for a while and then print the rest: Out of 123455 binary packages, 4223 are unmodified, but 213213 are possibly affected. Isn’t that due to lazy IO? print starts printing the string while it is evaluated, instead of evaluating the full string and printing it in one system call. Greetings, Joachim -- Joachim "nomeata" Breitner mail@joachim-breitner.de | nomeata@debian.org | GPG: 0x4743206C xmpp: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/