hGet package:heftia-effects

Read a ByteString directly from the specified Handle. This is far more efficient than reading the characters into a String and then using pack. First argument is the Handle to read from, and the second is the number of bytes to read. It returns the bytes read, up to n, or empty if EOF has been reached. hGet is implemented in terms of hGetBuf. If the handle is a pipe or socket, and the writing end is closed, hGet will behave as if EOF was reached.
hGetNonBlocking is similar to hGet, except that it will never block waiting for data to become available, instead it returns only whatever data is available. If there is no data available to be read, hGetNonBlocking returns empty. Note: on Windows and with Haskell implementation other than GHC, this function does not work correctly; it behaves identically to hGet.