#1691: Data.Map.deleteAt broken with index 0
-----------------------------+----------------------------------------------
  Reporter:  guest           |          Owner:       
      Type:  bug             |         Status:  new  
  Priority:  normal          |      Milestone:       
 Component:  libraries/base  |        Version:  6.6.1
  Severity:  normal          |       Keywords:       
Difficulty:  Unknown         |             Os:  Linux
  Testcase:                  |   Architecture:  x86  
-----------------------------+----------------------------------------------
Take a look at this ghci session:

 {{{
 Prelude> :m Data.Map
 Prelude Data.Map> Data.Map.deleteAt 0 (Data.Map.fromList [(0::Int,
 0::Int), (1,1), (2, 2), (3, 3)])
 fromList []
 Prelude Data.Map> Data.Map.elemAt 0 (Data.Map.fromList [(0::Int, 0::Int),
 (1,1), (2, 2), (3, 3)])
 (0,0)
 }}}

 In other words, deleteAt with index 0 deletes *everything* in the map, not
 just the first element in it.

 {{{
 Prelude Data.Map> Data.Map.deleteAt 1 (Data.Map.fromList [(0::Int,
 0::Int), (1,1), (2, 2), (3, 3)])
 fromList [(0,0),(2,2),(3,3)]
 }}}

 That appears to work as it should.  It seems that there is something wrong
 with an index of 0.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1691>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to