Haskell: read input character from console immediately, not after newline.

Posted by Steves on Stack Overflow See other posts from Stack Overflow or by Steves
Published on 2010-06-06T11:14:09Z Indexed on 2010/06/06 11:22 UTC
Read the original article Hit count: 294

Filed under:
|

I've tried this:

main = do
    hSetBuffering stdin NoBuffering 
    c <- getChar

but it waits until the enter is pressed, which is not what I want. I want to read the character immediately after user presses it.

I am using ghc v6.12.1 on Windows 7.

© Stack Overflow or respective owner

Related posts about haskell

Related posts about haskell-io