[Haskell-cafe] ghc --make Vs runhaskell

Tristan Seligmann mithrandi at mithrandi.net
Wed Feb 4 03:35:45 UTC 2015

On 4 February 2015 at 05:23, Madhu Babu <madhub.bits at gmail.com> wrote:
> Basically, in the following code, we print a line first and the read the
> line from stdin. This behavior works perfectly fine when using “runhaskell
> guess.hs”. But when i say “./guess”, i had to type in a number directly (
> i.e. first prompt is skipped ).

This is most likely due to stdio buffering; usually stdin/stdout are
line buffered, so data you write with putStr may not actually be
written until a newline is written. This post / thread details some
ways to handle this problem:

mithrandi, i Ainil en-Balandor, a faer Ambar

More information about the Haskell-Cafe mailing list