-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
insertLookup function ? #245
Comments
It's not entirely obvious, but this can be implemented using It would still be nice to have a special-purpose function for this though. |
What does the implementation in terms of I suspect that it might not cross the Fairbairn threshold – in that case I'd probably prefer to add it only as an example in the |
I believe it would be insertLookup :: (Eq k, Hashable k) => k -> v -> HashMap k v -> (Maybe v, HashMap k v)
insertLookup k v = alterF (\old -> (old, Just v)) k
|
Hm, consistency with If there's a choice between making it easier to use |
Data.HashMap seems to lack one, although such a function is important for performance reasons.
The text was updated successfully, but these errors were encountered: