[Haskell-cafe] Simple hash table creation

michael rice nowgate at yahoo.com
Tue Nov 17 14:16:50 EST 2009


I'm trying to create a hash table. Yeah, I know, don't use hash tables, but I need to create something I'm familiar with, not something I've never worked with before. What's wrong with this code?

Michael

====================

import Prelude hiding (lookup)
import Data.HashTable

data MyHashTable = HashTable String Int

dummy:: String -> Int
dummy s = 7

ht = MyHashTable.new (==) dummy

====================

[michael at localhost ~]$ ghci hash1
GHCi, version 6.10.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( hash1.hs, interpreted )

hash1.hs:9:5: Not in scope: `MyHashTable.new'
Failed, modules loaded: none.
Prelude> 




      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091117/70b4f674/attachment.html


More information about the Haskell-Cafe mailing list