[Haskell-cafe] Very Basic IO question

Lennart Augustsson lennart at augustsson.net
Sat Mar 3 04:21:29 EST 2007


Well, C stdio has this nice thing that if you read from stdin then  
stdout is automagically flushed first (maybe only if both are ttys).   
I think Haskell should have that too.

	-- Lennart

On Mar 3, 2007, at 07:10 , Bryan O'Sullivan wrote:

> Joe Olivas wrote:
>
>> However, changing 'putStrLn' to 'putStr' does not do what I would  
>> expect.  The prompt doesn't get displayed until after there is input:
>
> This isn't a Haskell issue per se.  The runtime is putting stdout  
> into line-buffered mode, so you need to import System.IO and use  
> hFlush stdout to get it to flush your prompt string out of its  
> buffer.  You'd see the same behaviour in C (if using stdio),  
> Python, etc.
>
> 	<b
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list