|
[GHC] #661: Serious Data.HashTable bug: msg#00124lang.haskell.glasgow.bugs
#661: Serious Data.HashTable bug -----------------------------------+---------------------------------------- Reporter: jwr@xxxxxxxxxxxxxx | Owner: Type: bug | Status: new Priority: high | Milestone: Component: libraries/base | Version: 6.4.1 Severity: major | Keywords: Os: Unknown | Difficulty: Unknown Architecture: Unknown | -----------------------------------+---------------------------------------- The program below illustrates a difference between the description of the semantics of insert (given below) and the implementation. Try calling the function "test" with values greater than 2047. For instance: HT> test 2048 0 1024 The documentation states: insert :: HashTable key val -> key -> val -> IO () Inserts an key/value mapping into the hash table. Note that insert doesn't remove the old entry from the table - the behaviour is like an association list, where lookup returns the most-recently-inserted mapping for a key in the table. The reason for this is to keep insert as efficient as possible. If you need to update a mapping, then we provide update. {{{ module HT where import Data.HashTable import qualified Data.HashTable as HT test :: Int -> IO () test n = do ht <- new (==) hashInt sequence_ [ insert ht key 0 | key <- [0..n]] sequence_ [ insert ht key 1 | key <- [0..n]] let check key = do (Just val) <- HT.lookup ht key if val==1 then return () else putStrLn $ show key sequence_ [ check key | key <- [0..n]] }}} -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/661> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler_______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@xxxxxxxxxxx http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: ghci module list, Simon Marlow |
|---|---|
| Next by Date: | Re: [GHC] #661: Serious Data.HashTable bug, GHC |
| Previous by Thread: | Re: ghci module list, Simon Marlow |
| Next by Thread: | Re: [GHC] #661: Serious Data.HashTable bug, GHC |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |