[Haskell-cafe] Unboxed arrays

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Mar 26 08:53:57 EDT 2008

Hello Andrew,

Wednesday, March 26, 2008, 3:37:53 PM, you wrote:

> type of your own, you just need to write your own instance". The thing
> that makes me suspicious of this logic is the absense of an instance for
> tuples.

> Any insights here?

and even insiders :)  i've rewrote arrays library to be more uniform
using ideas of Simon Marlow and Oleg Kiselyov

unboxed arrays implementation uses GHC primitives that fetches/stores
array element by its index. these primitives implemented for simple
types - from Word8 to Double but nothing more. they use *indexes*, not
*byte offsets* which means that you can use them for addressing array
of {Word8,Double}, for example

i believe that it should be possible to rewrite array machinery using
storable class (now it should not have any overheads compared to these
primitives). meanwhile i recommend you to use storable array together
with Storable instances for tuples

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

More information about the Haskell-Cafe mailing list