Removing lazy IO?

Joachim Breitner mail at joachim-breitner.de
Thu Nov 10 09:01:14 CET 2011


Hi,

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
>         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 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
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/libraries/attachments/20111110/ceff4f15/attachment.pgp>


More information about the Libraries mailing list