[Haskell-cafe] Hash table constructors return table in IO Monad. Why?

michael rice nowgate at yahoo.com
Thu May 12 21:59:48 CEST 2011

Thanks, Bryan and Stephan.
I seem to remember playing around with a data structure that accumulates (in a list) different values associated with an identical key, i.e.,
insert data-structure "abc" 5insert data-structure "abc" 6
retrieve data-structure "abc" -> [5,6]
HashTable doesn't do it. Neither does Map. Was I dreaming?

--- On Thu, 5/12/11, Bryan O'Sullivan <bos at serpentine.com> wrote:

From: Bryan O'Sullivan <bos at serpentine.com>
Subject: Re: [Haskell-cafe] Hash table constructors return table in IO Monad. Why?
To: "Stephen Tetley" <stephen.tetley at gmail.com>
Cc: haskell-cafe at haskell.org
Date: Thursday, May 12, 2011, 2:22 PM

On Thu, May 12, 2011 at 9:22 AM, Stephen Tetley <stephen.tetley at gmail.com> wrote:

The hashtable needs to be been created in IO, after that, think of the

'hashtable' as a analogous to a file handle. You have to pass it

around to do anything with it - but the only things you can do with it

are in IO.

The appropriate pure package to be using instead is unordered-containers.

-----Inline Attachment Follows-----

Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110512/2c0cec00/attachment.htm>

More information about the Haskell-Cafe mailing list