You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- The function returns original value, if it is updated.
-- This is different behavior than 'Data.Map.updateLookupWithKey'.
-- Returns the original key value if the map entry is deleted.
This really bothers me, but I don't think we should change one of them to be like the other because it could introduce a subtle bug for existing users.
Hackage Search (https://hackage-search.serokell.io/?q=updateLookupWithKey) indicates that most users are using it as updateLookupWithKey (\_ _ -> Nothing), which means they want to delete an entry and get the deleted value. This suggests that it would be useful have a function for that purpose.
But even if we add that, we can't get rid of updateLookupWithKey because there is a lot of code out there using the function. The two implementations have been around since the very beginning (bbbba97).
Maybe we just have to live with it.
The text was updated successfully, but these errors were encountered:
Data.Map.updateLookupWithKey
andData.IntMap.updateLookupWithKey
have different behaviors on replacement.containers/containers/src/Data/Map/Internal.hs
Lines 1121 to 1123 in 32c80d8
containers/containers/src/Data/IntMap/Internal.hs
Lines 988 to 991 in 32c80d8
This really bothers me, but I don't think we should change one of them to be like the other because it could introduce a subtle bug for existing users.
Hackage Search (https://hackage-search.serokell.io/?q=updateLookupWithKey) indicates that most users are using it as
updateLookupWithKey (\_ _ -> Nothing)
, which means they want to delete an entry and get the deleted value. This suggests that it would be useful have a function for that purpose.But even if we add that, we can't get rid of
updateLookupWithKey
because there is a lot of code out there using the function. The two implementations have been around since the very beginning (bbbba97).Maybe we just have to live with it.
The text was updated successfully, but these errors were encountered: