[Haskell-cafe] Unboxed arrays
roma at ro-che.info
Wed Mar 26 10:23:57 EDT 2008
* Henning Thielemann <lemming at henning-thielemann.de> [2008-03-26 14:22:20+0100]
> On Wed, 26 Mar 2008, Roman Cheplyaka wrote:
>> * Andrew Coppin <andrewcoppin at btinternet.com> [2008-03-26 12:37:53+0000]
>>> Somebody asked me, so now I'm asking you...
>>> In Haskell, you can make "unboxed" arrays of certain value types. These
>>> are typically more efficient in space, and probably time too, and also
>>> make the array strict in its values. However, you can only do this magic
>>> trick for certain types - not for *all* types.
>>> Why is that? Is it because nobody has done anything about it yet? Is it
>>> because it's thought to be "not necessary" in some way? Is there some
>>> theoretical problem? Has somebody got a better idea?
>>> I did think it was along the lines of "oh, well, if you want to unbox a
>>> 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. Surely this would be trivial to write, and yet it's not present.
>>> If we had instances for a couple of sizes of tuples, it would surely be
>>> quite easy to write your own custom instances that just sit on top of
>>> this and tuple/untuple your custom values...
>>> Any insights here?
>> Could Data Parallel Haskell be useful for you?
>> It was designed for parallel computation, but it includes unboxed
>> arrays, nice list-like syntax and array comprehensions.
>> 1. http://www.haskell.org/haskellwiki/GHC/Data_Parallel_Haskell
> A light-weight unboxed array variant is:
> I thought it might be more efficient sometimes to split, say Word8 and
> Double data into two arrays, instead of padding data in order to align a
> (Word8,Double) record, but this wouldn't fit into the array data
As far as I know, ndp (which I linked above) takes exactly this
Roman I. Cheplyaka :: http://ro-che.info/
...being in love is totally punk rock...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 307 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20080326/49926f2d/attachment.bin
More information about the Haskell-Cafe