[Haskell-cafe] FiniteMap-like module for unordered keys?

Graham Klyne gk at ninebynine.org
Wed Nov 10 05:53:37 EST 2004


At 23:25 09/11/04 +0100, Remi Turk wrote:
> > (I looked at Data.HashTable, but I couldn't figure why it needs to be
> > implemented in the IO monad, except to optimize the internal
> > implementation.  Also, it's not clear to me how it behaves when a key is
> > inserted that already exists.)
>A hash-table becomes rather useless without mutable state AFAICS.
>Without it, one might almost just as well use a list of pairs...
>Actually, some kind of freezeHashTable may be useful, and
>a HashTable in the ST monad is definitely useful: I guess patches
>are welcome..

I can see why using (something like) a state monad might be useful, but not 
why it needs to be an IO monad, unless there's some fairly low-down 
optimization being performed.

(I'm not asking for this, BTW, just commenting on the apparent lack.  For 
my application, I am using a list of pairs, as I expect these tables to be 
relatively small.)

#g


------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact



More information about the Haskell-Cafe mailing list