[Haskell] behavioral difference between GHC and GHCi

Thomas L. Bevan thomas_bevan at toll.com.au
Mon Feb 9 11:21:31 EST 2004


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:me at alexjacobson.com
> tel:917-770-6565                       http://alexjacobson.com
> _______________________________________________
> Haskell mailing list
> Haskell at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell

-- 
Why be a man when you can be a success?
		-- Bertolt Brecht


More information about the Haskell mailing list