
BTW, I already found a major problem with the code I attached earlier, using unsafeInterleaveIO: Run in GHCi (as I had done), it works fine; but compiled by GHC and run as an executable, it waits for input and *then* displays the prompt after the user hits Enter ... not very helpful. I didn't think it would do that, since (putStr "? " >> readLn) seemed pretty explicit as to order of evaluation, but I guess that's what I get for breaking referential transparency ...
You probably want to set the buffering otherwise. GHCi automatically sets the buffering to nobuffering when it starts, so this probably explains why you don't experience the problem in GHCi. Import IO and do something like: hSetBuffering stdout NoBuffering -- or LineBuffering hSetBuffering stdin NoBuffering ...something like that... HTH - Hal