implement hash table

ketil+haskell at ii.uib.no ketil+haskell at ii.uib.no
Wed Oct 8 11:40:03 EDT 2003


dons at cse.unsw.edu.au (Donald Bruce Stewart) writes:

>> I'm a new one in this Haskell programming language. 

Okay, since you're new, I won't take your question too literally. :-)

>> I have a program which involved a lot of computation tasks and it's
>> quite inefficient,so I'm currently examing the possibility of using
>> hash table in my data structure, can some one tell me how to
>> implement it? I can't find much information about it.

>     http://www.haskell.org/ghc/docs/latest/html/base/Data.HashTable.html

Note that this lives in the IO monad.  This may be fine for your
purposes, but are you quite sure you need a hash table, and that you
can't use either Data.Set or Data.FiniteMap instead?

These used balanced trees, and have O(log n) access times, but IME
that is fine for most purposes (and given hierarchical memory systems
on modern computers, one could argue that you get this from a hash
table, too)

http://www.haskell.org/ghc/docs/latest/html/base/Data.FiniteMap.html
http://www.haskell.org/ghc/docs/latest/html/base/Data.Set.html

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


More information about the Haskell mailing list