Questions about the array APIs

Simon Marlow simonmarhaskell at gmail.com
Mon Nov 20 07:44:16 EST 2006


Iavor Diatchki wrote:
> I am aware of the unsafe methods to cast arrays.  My question was if
> there was a function in the libraries to dump an immutable array of
> bytes to a handle, that is safe (it could, of course, be implemented
> behind the scene using unsafe primitives, however, this is
> implementation specific).  My impression was that there isn't one, and
> I guess you are confirming this.  I think it would be useful to have
> such a function in the libraries.

It's true that there isn't a way to write an arbitrary UArray to a Handle as a 
sequence of bytes, but there is also no requirement that a UArray is even 
implemented as a sequence of bytes either; indeed the Hugs implementation 
doesn't represent a UArray using unboxed elements.  If we were to add a way to 
serialise a UArray to a Handle, we'd also have to specify the exact serialised 
representation (or leave it undefined).

Cheers,
	Simon





More information about the Libraries mailing list