Removing lazy IO?
mail at joachim-breitner.de
Thu Nov 10 09:01:14 CET 2011
Am Mittwoch, den 09.11.2011, 20:33 -0500 schrieb Edward Kmett:
> On Wed, Nov 9, 2011 at 5:38 PM, Joachim Breitner
> <mail at joachim-breitner.de> wrote:
> I very much like the lazy O in lazy IO, e.g. with this real-life code
> 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
When it is run, it will print
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
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
Joachim "nomeata" Breitner
mail at joachim-breitner.de | nomeata at debian.org | GPG: 0x4743206C
xmpp: nomeata at joachim-breitner.de | http://www.joachim-breitner.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: This is a digitally signed message part
More information about the Libraries