[Haskell-cafe] What's the deal with Clean?

Duncan Coutts duncan.coutts at googlemail.com
Wed Nov 4 04:56:49 EST 2009


On Tue, 2009-11-03 at 18:12 -0800, brian wrote:
> Really, arrays in Haskell are the most @#!$! confusing thing in the  
> world.
> 
> There's a bunch of different array structures.
> 
> I can't tell which one works best, and all I want to do is x[i] = value.

> I thought uvector was the answer, you know, fast unboxed ARRAYs.   

Rather than confusing yourself with new packages like uvector I suggest
you just use the arrays from the standard 'array' package that comes
with GHC. It provides mutable and immutable, boxed and unboxed arrays.

The mutable ones have to be used in a monad (ST or IO).

The boxed ones can be used with any element type (eg an array of
records) while unboxed ones work with simple primitive types like ints,
floats etc. The difference is about memory layout and therefore
performance: unboxed ones are simple flat C-like arrays while the boxed
ones are arrays of pointers to heap objects.

Duncan



More information about the Haskell-Cafe mailing list