[Haskell] How to read one char from stdin and return immediately?
HaihuaLin at 163.com
Fri Aug 18 08:09:50 EDT 2006
How to read one char from stdin and return immediately?
I mean there is no need to wait the user input a return.
Print "y/n: "
Users input y, return immediately, no return need.
I have tried code as below, but it didn't work for me.
main = do
hSetBuffering stdout NoBuffering
putStr "Y/N: "
c <- getChar
putStr ("Your input is " ++ show c++".\n")
Thanks very much.
More information about the Haskell