Computation hWaitForInput hdl t
waits until input is available on handle hdl.
It returns True as soon as input is available on hdl,
or False if no input is available within t milliseconds. Note that
hWaitForInput waits until one or more full characters are available,
which means that it needs to do decoding, and hence may fail
with a decoding error.
If t is less than zero, then hWaitForInput waits indefinitely.
This operation may fail with:
isEOFError if the end of file has been reached.
a decoding error, if the input begins with an invalid byte sequence in this Handle's encoding.
NOTE for GHC users: unless you use the -threaded flag,
hWaitForInput hdl t where t >= 0 will block all other Haskell
threads for the duration of the call. It behaves like a
safe foreign call in this respect.