[GHC] #2359: Data.IntMap update{Min, Max}WithKey corrupts data structure

GHC trac at galois.com
Sat Jun 14 14:57:02 EDT 2008


#2359: Data.IntMap update{Min,Max}WithKey corrupts data structure
-------------------------------+--------------------------------------------
    Reporter:  nwf             |       Owner:                
        Type:  bug             |      Status:  new           
    Priority:  normal          |   Component:  libraries/base
     Version:  6.8.2           |    Severity:  normal        
    Keywords:                  |    Testcase:                
Architecture:  x86_64 (amd64)  |          Os:  Linux         
-------------------------------+--------------------------------------------
 Updates on the supposedly minimum element aren't:

 {{{
 GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
 Loading package base ... linking ... done.
 Prelude> import Data.IntMap
 Prelude Data.IntMap> let base = (insert 2 "b" (singleton 1 "a"))
 Loading package array-0.1.0.0 ... linking ... done.
 Loading package containers-0.1.0.1 ... linking ... done.
 Prelude Data.IntMap> let umin = updateMinWithKey (\ k _ -> ("yo!" ++ (show
 k)) ) base
 Prelude Data.IntMap> umin
 fromList [(1,"a"),(2,"yo!2")]
 Prelude Data.IntMap> showTree umin
 "*\n+-- 1:=\"a\"\n+-- 2:=\"yo!2\"\n"
 }}}

 Updates on the maximum element are even worse, corrupting the data
 structure (ghci session continued):

 {{{
 Prelude Data.IntMap> let umax = updateMaxWithKey (\ k _ -> ("yo!" ++ (show
 k)) ) base
 Prelude Data.IntMap> umax
 fromList [(1,"yo!1"),(1,"a")]
 Prelude Data.IntMap> showTree umax
 "*\n+-- 1:=\"yo!1\"\n+-- 1:=\"a\"\n"
 }}}

 GHC is Debian 6.8.2-5.

 Anything else that would be helpful?
 Thanks much in advance.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2359>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list