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
I guess this one is a matter of use case, but currently if an element exists, it's being removed and the new element (with the same key) is now in the head of the list.
Hi @pzp1997 👋 The advantage of upsert is that it's either insert OR update, with the caller not having to bother with checking which should happen (in a way same as core's Dict.insert is actually both an insert or update)
You could always do Dict.update key (always (Just value)) dict but I agree that we can make this more obvious by adding an upsert function. I'll put it on the docket for 1.1.0.
I guess this one is a matter of use case, but currently if an element exists, it's being removed and the new element (with the same key) is now in the head of the list.
assoc-list/src/AssocList.elm
Lines 188 to 189 in 63ffd69
So, maybe we need to add a new function that will maintain the position of the element, only change the value?
The text was updated successfully, but these errors were encountered: