A bug in IntMap

Scott Turner p.turner at computer.org
Wed Jul 6 11:48:23 EDT 2005


The bug is right there in split.  Data/IntMap.hs needs:

***************
*** 750,755 ****
--- 750,756 ----
  split k t
    = case t of
        Bin p m l r
+       | nomatch k p m -> if k>p then (t,Nil) else (Nil,t)
          | zero k m  -> let (lt,gt) = split k l in (lt,union gt r)
          | otherwise -> let (lt,gt) = split k r in (union l lt,gt)
        Tip ky y
***************
*** 764,769 ****
--- 765,771 ----
  splitLookup k t
    = case t of
        Bin p m l r
+       | nomatch k p m -> if k>p then (t,Nothing,Nil) else (Nil,Nothing,t)
          | zero k m  -> let (lt,found,gt) = splitLookup k l in 
(lt,found,union gt r)
          | otherwise -> let (lt,found,gt) = splitLookup k r in (union l 
lt,found,gt)
        Tip ky y


More information about the Libraries mailing list