[Haskell-cafe] Help with terminal IO

Ryan Ingram ryani.spam at gmail.com
Sun May 27 20:35:05 EDT 2007


I was hoping that hSetBuffering would turn off the line buffering for stdin,
but it doesn't seem to work.

----
module Main where
import System.IO

main :: IO ()
main = do
    hSetBuffering stdin NoBuffering
    hSetBuffering stdout NoBuffering

    hPutChar stdout '>'
    c <- hGetChar stdin
    hPutChar stdout '<'
----

This program should terminate immediately after the first character is typed
into the terminal, but it waits until I type a newline.  It also looks like
it's using GNU readline (it handles the up & down arrow keys.)

How do I turn this off and use raw character-based IO?  I'm using GHC6.6 on
Win32 if that makes a difference.

  -- ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070527/6f10ca0a/attachment.htm


More information about the Haskell-Cafe mailing list