[Haskell-cafe] Needing strictness?

michael rice nowgate at yahoo.com
Wed Oct 21 22:49:07 EDT 2009


Hi Daniel,

The first fix wouldn't work, but the second one (hFlush) did.

Thanks,

Michael

--- On Wed, 10/21/09, Daniel Fischer <daniel.is.fischer at web.de> wrote:

From: Daniel Fischer <daniel.is.fischer at web.de>
Subject: Re: [Haskell-cafe] Needing strictness?
To: haskell-cafe at haskell.org
Cc: "michael rice" <nowgate at yahoo.com>
Date: Wednesday, October 21, 2009, 10:27 PM

Am Donnerstag 22 Oktober 2009 04:15:56 schrieb michael rice:
> Busy night. I wanted the question and response to be on the same line (see
> below), so I used putStr instead of putStrLn, but Haskell jumps the gun and
> goes to the second line to get the response before the question ever gets
> printed. Is this an example of needing strictness? How would I do that, or
> something else, to get the result I want?
>
>          putStrLn "Some yes/no question (y/n)?"
>          ans <- getLine
>
> Michael

Hit send too quickly:

alternatively

hFlush stdout

between question and answer.



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091021/7fdd4c69/attachment.html


More information about the Haskell-Cafe mailing list