[Haskell-cafe] Re: Read a single char

Maurí­cio briqueabraque at yahoo.com
Mon Oct 23 21:14:02 EDT 2006


Donald Bruce Stewart wrote:
> briqueabraque:
>>   Hi,
>>
>>   How can I read a single character from standard output? I would like 
>> the user to press a single key and the reading function return 
>> imediately after that key is pressed.
> 
> so you want a function of type:
>     IO Char
> 
> asking Hoogle (http://haskell.org/hoogle) we get:
>     Prelude.              getChar            :: IO Char
>     IO.                   hGetChar           :: Handle -> IO Char
> 
> -- Don

   getChar doesn't return until I press Enter. I need something that 
returns immediately after I press any key.

   Thanks,
   Maurício



More information about the Haskell-Cafe mailing list