Data.Map.updateAt problem
Andriy Palamarchuk
apa3a at yahoo.com
Wed Jul 18 09:24:03 EDT 2007
I'm currently improving Data.Map documentation.
Behavior of updateAt in this module differs from what I would expect.
The documentation says:
updateAt :: (k -> a -> Maybe a) -> Int -> Map k a -> Map k a
O(log n). Update the element at index. Calls error when an invalid index is used.
So I expected this code:
let m = fromList [(3,"b"),(5,"a")]
let f k a = Just "x"
updateAt f 1 m
to return
fromList [(3,"b"),(5,"x")]
but it returns
fromList [(5,"x")]
deleting the key 3.
I tested this using ghci 6.6.
Is this a bug or I missed something here?
Thanks,
Andriy
____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
More information about the Libraries
mailing list