[Haskell-cafe] Simple hash table creation

michael rice nowgate at yahoo.com
Tue Nov 17 15:09:26 EST 2009

Hi Daniel,

Thanks for the IO monad reminder.

What is GHC.Int.Int32? Can't find it on Hoogle.



*Main> ht <- new (==) dummy :: IO MyHashTable


    Couldn't match expected type `GHC.Int.Int32'

           against inferred type `Int'

    In the second argument of `new', namely `dummy'

    In a stmt of a 'do' expression:

        ht <- new (==) dummy :: IO MyHashTable

*Main> :t dummy

dummy :: String -> Int


--- On Tue, 11/17/09, Daniel Fischer <daniel.is.fischer at web.de> wrote:

From: Daniel Fischer <daniel.is.fischer at web.de>
Subject: Re: [Haskell-cafe] Simple hash table creation
To: haskell-cafe at haskell.org
Date: Tuesday, November 17, 2009, 2:45 PM

Am Dienstag 17 November 2009 20:36:46 schrieb Daniel Fischer:
> What you probably wanted was
> type MyHashTable = HashTable String Int -- not data MyHashTable

Just in case it's not clear:

> ht <- new (==) dummy :: IO MyHashTable

only works at the prompt or in an IO do-block, not at the top level of the module.

> then ht is a hashtable of type MyHashTable.

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/20091117/2f9ad958/attachment-0001.html

More information about the Haskell-Cafe mailing list