11.2.  Interacting with the terminal

By default GHC builds applications that open a console window when they start. If you want to build a GUI-only application, with no console window, use the flag -optl-mwindows in the link step.

Warning: Windows GUI-only programs have no stdin, stdout or stderr so using the ordinary Haskell input/output functions will cause your program to fail with an IO exception, such as:

      Fail: <stdout>: hPutChar: failed (Bad file descriptor)

However using Debug.Trace.trace is alright because it uses Windows debugging output support rather than stderr.

For some reason, Mingw ships with the readline library, but not with the readline headers. As a result, GHC (like Hugs) does not use readline for interactive input on Windows. You can get a close simulation by using an emacs shell buffer!