Is there a non-blocking version of hGetArray?

Simon Marlow simonmar at
Fri Oct 1 16:34:36 EDT 2004

On 01 October 2004 08:45, Peter Simons wrote:

> I am a happy user of hGetBufNonBlocking, but I have come to
> realize that mutable arrays are nicer to work with than
> pointers, so I have considered using hGetArray instead. I
> do, however, depend on the fact that the function returns as
> soon as it has read data -- even if less than requested --,
> like hGetBufNonBlocking does.
> Is there currently a way to achieve this?

Not currently, but I could probably implement the equivalent

> Am I right assuming that hGetBuf and hGetArray do not differ
> much performance-wise?

Hopefully not.

> One of the reasons I am curious about using mutable arrays
> is because of Data.Array.Base.unsafeRead, which seems to be
> a *lot* faster than accessing the memory through a pointer.
> Is there anything comparable for pointer access?

I'm surprised if pointer access to memory is slower than unsafeRead.
Could you post some code that we can peer at?


More information about the Glasgow-haskell-users mailing list