[Haskell-cafe] Character I/O

Judah Jacobson judah.jacobson at gmail.com
Tue Mar 31 16:42:57 EDT 2009


On Tue, Mar 31, 2009 at 12:53 PM, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:
> Edward Kmett wrote:
>>
>> You want to use:
>>  > main = do hSetBuffering stdin NoBuffering; c <- getChar
>
> Already tried that. It appears to make no difference.

Sounds like you're on Windows, so it's probably this bug:

http://hackage.haskell.org/trac/ghc/ticket/2189

Although: if you're trying to get at the arrow keys from the Windows
cmd console, it's not possible by reading stdin; rather, you need to
access the lower-level Win32 console APIs:

http://msdn.microsoft.com/en-us/library/ms682073(VS.85).aspx

Not sure if it will help, but you could take a look at what I did in Haskeline:

http://code.haskell.org/haskeline/System/Console/Haskeline/Backend/Win32.hsc

-Judah


More information about the Haskell-Cafe mailing list