How to print output and ask input on the same line

leledumbo leledumbo_cool at yahoo.co.id
Mon Sep 15 00:10:24 EDT 2008


This is my main function:

main = do
  putStr "What's the value that each equation must satisfy? "
  c <- readLn
  putStr "How many unknowns are there? "
  n <- readLn
  sequence_ (result c n)

Using runhugs / winhugs / ghci, I can see every output of putStr before it
stops for readLn. But compiling it with ghc, it just stops for readLn and
putStr output is printed together with sequence_' one. So, instead of:

What's the value that each equation must satisfy? <stop for readLn>
How many unknowns are there? <stop for readLn>
<output of sequence_>

I got:

<stop for readLn>
<stop for readLn>
What's the value that each equation must satisfy?
How many unknowns are there?
<output of sequence_>

Hope that's clear enough.
-- 
View this message in context: http://www.nabble.com/How-to-print-output-and-ask-input-on-the-same-line-tp19487040p19487040.html
Sent from the Haskell - Glasgow-haskell-users mailing list archive at Nabble.com.



More information about the Glasgow-haskell-users mailing list