Questions about the array APIs

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Nov 15 13:01:59 EST 2006


Hello Chris,

Wednesday, November 15, 2006, 8:46:47 PM, you wrote:

>> 1. Is there a way to write an immutable array to a handle without
>> using any unsafe methods?

> If you mean "can I treat the array as a large block of bytes as dump that to a
> handle?" then you need Data.Array.IO.hPutArray and hGetArray.
> Or possibly Data.Array.Storable with Foreign.Marshal.Array might help.

and unboxed arrays, of course

>> 2. Why does the function 'getBounds' (of the 'MArray' class) return
>> its result in a monad?

> It is so that mutable arrays which dynamically change their bounds can be supported.

arrayref library contains implementation of dynamic arrays that can be easily
ported to using Base library primitives


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Libraries mailing list