[Haskell-cafe] Bug in "Haskell for C programmers" tutorial?

Cale Gibbard cgibbard at gmail.com
Sat Dec 31 20:08:56 EST 2005


You shouldn't have to flush output manually. Which implementation are
you using? Try importing System.IO and doing:
hGetBuffering stdout >>= print
and see what gets printed. It should be "NoBuffering". If for whatever
reason it's not, you can set it to that at the start of your programs
with
hSetBuffering stdout NoBuffering

If it's still NoBuffering, check that your terminal isn't doing
something strange.

hope this helps,
 - Cale

On 31/12/05, Erik de Castro Lopo <hc-erikd at mega-nerd.com> wrote:
> Erik de Castro Lopo wrote:
>
> > Hi all,
> >
> > I'm working through the "Haskell for C programmers" tutorial
> > and in this section":
>
>     http://www.haskell.org/~pairwise/intro/section3.html#part7
>
> has:
>
>     main = do
>         putStr "prompt 1"
>         a <- getLine
>         putStr "prompt 2"
>         b <- getLine
>         putStrLn (show (someFunc (read a) (read b)))
>
> which I believe needs a:
>
>         hFlush stdout
>
> after each "putStr" line and an "import System.IO" at the top of
> the file.
>
> Erik
> --
> +-----------------------------------------------------------+
>   Erik de Castro Lopo
> +-----------------------------------------------------------+
> "Ever since GNOME development began, I have urged people to aim
> to make it as good as the Macintosh. To try to be like Windows
> is to try for second-best." - Richard Stallman
> _______________________________________________
> 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