[Haskell] Sequencing of input and output, troubles in
kdevelop
Keith Wansbrough
Keith.Wansbrough at cl.cam.ac.uk
Fri Aug 27 06:53:15 EDT 2004
> "A.J. Bonnema" <abonnema at xs4all.nl> writes:
>
> > Why doesn't kdevelop generate code, that executes the statements in
> > order? Or should I be looking at ghc? Or is it an option I am missing?
>
> GHCi behaves like Hugs. My guess would be that kdevelop attaches
> pipes for standard input and output, and GHC or whatever backend it
> uses realizes it is not talking to a terminal, and applies buffering.
In other words - if kdevelop is supposed to support the use of interactive programs in its console window, it should allocate a pty, rather than just using ordinary Unix pipes. I would consider this a bug.
The fix for now is for you to explicitly turn off buffering:
import IO
main = do hSetBuffering stdin LineBuffering
hSetBuffering stdout NoBuffering
hSetBuffering stderr NoBuffering
...
(warning: untested code)
--KW 8-)
--
Keith Wansbrough <kw217 at cl.cam.ac.uk>
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
More information about the Haskell
mailing list