
* Andrew Coppin
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[1] 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 -- Roman I. Cheplyaka :: http://ro-che.info/ ...being in love is totally punk rock...