[Haskell-cafe] implementing python-style dictionary in Haskell

Ketil Malde ketil at malde.org
Wed Nov 19 05:56:09 EST 2008

Tillmann Rendel <rendel at daimi.au.dk> writes:

> Why should a Haskell hash table need more memory then a Python hash
> table? I've heard that Data.HashTable is bad, so maybe writing a good
> one could be an option.

One problem is that Haskell collections are lazy by default.  I'm 
aware of a few use cases where laziness lets you formulate a very
elegant recursive population of a collection, but I think that in
general, strictness is what you want, and further, that if you want
lazy, you store your data as one-tuples: data Lazy a = Lazy a  

(If there's a workaround/solution in the other direction, I'd really
like to hear it).

I'm therefore tempted to suggest that collections should be
strict by default, and in particular, that there should be strict
arrays for arbitrary types, not just the ones that happen to be
unboxable. Unboxing should be an optimization for (some) strict

If I haven't seen further, it is by standing in the footprints of giants

More information about the Haskell-Cafe mailing list