
Am 18.03.2017 um 07:45 schrieb Brandon Allbery:
On Sat, Mar 18, 2017 at 1:52 AM,
wrote: I have narrowed the problem down to the "p <- liftIO getChar" statement.
It does run the second time, and gets the newline following the entered character. You should probably use getLine, or learn how your platform switches between default line-oriented input and character-oriented --- and how to switch it back afterward. (In C on Unix-like systems, this involves termios.)
System.IO.hSetBuffering is your friend ben@yuiitsu1:~> ghci Prelude> import System.IO Prelude System.IO> :info hSetBuffering hSetBuffering :: Handle -> BufferMode -> IO () Prelude System.IO> :info BufferMode data BufferMode = NoBuffering | LineBuffering | BlockBuffering (Maybe Int) Prelude System.IO> hSetBuffering stdin NoBuffering Prelude System.IO> getChar >> getChar Prelude System.IO> getChar >> getChar xy'y' # prompt returns immediately after i hit 'y' Prelude System.IO>