[Haskell] Re: Writing large n-dim un-boxed array of Int32 quickly?

Chung-chieh Shan ccshan at post.harvard.edu
Mon Oct 31 13:30:14 EST 2005

Rene de Visser <rene_de_visser at hotmail.com> wrote in article <BAY103-F1655F7499A305D6517DC50DA6C0 at phx.gbl> in gmane.comp.lang.haskell.general:
> To do this I need to cast my 5 dimensional array to a 1 dimensional
> array?  Does this work? i.e. how do I know that GHC uses a flat array
> representation for multidemsional arrays (rather than a nested model
> using pointers).

You know that the array type you are using uses a flat representation
because -it- doesn't know what index type you are using.  IOUArray must
be polymorphic over the index type (the first argument to the type
constructor IOUArray), so it can't do anything with the indices that the
Ix type class doesn't tell it how to do.  The Ix type class doesn't tell
IOUArray how many dimensions you have.

But you may also want to look into StorableArray.

Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
2005-11-06 Against Exploiting the Environment in War http://tinyurl.com/adhg9
2005-11-20 Universal Children's Day http://www.un.org/depts/dhl/children_day/
2005-11-25 Elimination of Violence Against Women http://tinyurl.com/drd57
2005-11-25 Buy Nothing Day http://www.buynothingday.co.uk/

More information about the Haskell mailing list