Alas, GHC provides no function to read from Fd to an allocated buffer. The library function fdRead is not appropriate as it returns a string already. I'd rather get data from a buffer. Furthermore, fdRead (at least in GHC) allocates a new buffer each time it is called. This is a waste. Yet another problem with fdRead is in raising an exception on any IOError or even EOF. I'd rather avoid exceptions altogether.
The following fseek procedure throws no exceptions.
Haskell representation for
The implementation is deliberately exposed, to allow users to add
their own definitions of