[Haskell-cafe] vector to uvector and back again

Roman Leshchinskiy rl at cse.unsw.edu.au
Thu Feb 11 21:57:40 EST 2010


On 12/02/2010, at 12:54, Dan Doel wrote:

> I also notice that vector seems to have discarded the idea of
> 
>  Vec (A * B) = Vec A * Vec B

Oh no, it hasn't. In contrast to uvector/DPH, which use a custom strict tuple type for  rather outdated reasons, vector uses normal tuples. For instance, Data.Vector.Unboxed.Vector (a,b,c) is internally represented as a triple of unboxed vectors of a, b and c. In general, vector supports 4 kinds of arrays at the moment:

Data.Vector.Primitive     wrappers around ByteArray#, can store primitive types
Data.Vector.Unboxed       uses type families, can store everything D.V.Primitive can
                          plus tuples and can be extended for user-defined types
Data.Vector.Storable      wrappers around ForeignPtr, can store Storable things
Data.Vector               boxed arrays

Roman




More information about the Haskell-Cafe mailing list