Questions about the array APIs

Iavor Diatchki iavor.diatchki at gmail.com
Fri Nov 17 12:26:52 EST 2006


Hello,

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.

> > There do not appear to be methods in the MArray class that allow
> > arrays to change their bounds...
>
> True:  There are MArray instances that cannot change their size, therefore the
> MArray class does not specify those operations are available.  It have merely
> been changed to accommodate them by making getBounds monadic.
>
> See http://haskell.org/haskellwiki/Library/ArrayRef#Reimplemented_Arrays_library
> for (possibly dynamically) resizable instances.

I was not aware of this, thanks for the reference.  I need to look at
it more closely, but didn't this decision remove an important point in
the design space, namely mutable arrays of a fixed size?  I would
imagine these are quite important when you care about managing
resources.   I guess the monadic 'getBounds' still supports them but
it looses some type information...

-Iavor


More information about the Libraries mailing list