You're not really doing anything wrong. You're just another victim of 
line buffering. 
Try this,

import IO

main = do
 hSetBuffering stdout LineBuffering
 main2

main2 = do
 x<-hGetLine stdin
 putStrLn  x
 main2

On Mon, 09 Feb 2004 11:06 am, S. Alexander Jacobson wrote:
> This code works echos lines properly under GHCi,
> but just sucks in input when running the GHC
> compiled executable.
>
>   import IO
>   main= do
>         x<-hGetLine stdin
>         putStr x
>         main
>
> Am I doing something wrong?
>
> -Alex-
>
> _________________________________________________________________
> S. Alexander Jacobson                  mailto:[EMAIL PROTECTED]
> tel:917-770-6565                       http://alexjacobson.com
> _______________________________________________
> Haskell mailing list
> [EMAIL PROTECTED]
> http://www.haskell.org/mailman/listinfo/haskell

-- 
Why be a man when you can be a success?
                -- Bertolt Brecht
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to