Serge D. Mechveliani wrote:

> > Haskell is outputting lazily, but by default stdout is set to 
> > LineBuffering - for efficiency, a line is only written to stdout 
> > once it is complete.  Try adding "\n" to the end of the "min2 =" 
> > line to see what I mean.
> > To get the behaviour you describe, add import IO  and 
> > hSetBuffering stdout NoBuffering >>  to the start of your main function.
> 
> 
> ( and what if it also aplies  writeFile "log"  ? )

Streams which are associated with files are fully-buffered by default,
so writeFile would generate the output in blocks. If you wanted to
change the buffering, you would have to open the file yourself so that
you could get at the descriptor, e.g.

        handle <- openFile "log" AppendMode
        hSetBuffering handle NoBuffering
        hPutStr handle string
        hClose handle 

-- 
Glynn Clements <[EMAIL PROTECTED]>
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to