
Hello FFT, Monday, April 6, 2009, 12:56:51 PM, you wrote:
Are those the only legal contents of STUArray?
numbers, chars, vanilla pointers. UArray just mimics C arrays, after all
I haven't gotten to learning about them in detail yet, but my hope was that STUArray was like vector<T> in C++, and STArray was like vector
. Both are fairly general.
well, that's good comparison for some degree, but the catch is that Haskell doesn't have unboxed types at all. therefore, [ST]UArray is something that you can't implement in pure Haskell, it's just like providing API to some C arrays. they are implemented via special operations in GHC runtime that are limited to support only numbers/chars/pointers. so you can't have UArray of Complex numbers (although you can use two array of Doubles of course) UArray is rather old thing, nowadays you may use StorableArray or one of many newer array/vector libraries. unfortunately, they tend to don't support ST monad, so you will need to write a little wrappers using unsafeIOtoST operation
So if I need a array of complex numbers in Haskell, will I need an extra level of indirection compared to C? And in addition to that some serious issues with GC speed if those arrays need to be mutable?
[1] http://haskell.org/haskellwiki/Library/ArrayRef [2] http://www.haskell.org/haskellwiki/Storable_Vector recent cafe threads http://www.haskell.org/pipermail/haskell-cafe/2008-July/045229.html http://www.haskell.org/pipermail/haskell-cafe/2009-March/057240.html -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com