Why is there no mapKeys in the Data.Hashmap?

I want to use a function like mapKeys to map for keys only. There is a mapKeys function in mapKeys , but there are no analogues in Data.Hashmap . Moreover, in Data.Hashmap I did not find anything about key manipulation. Is there only an incompleteness of the Data.Hashmap module or are there any ideological reasons for not doing this?

+3
source share
1 answer

A hash map provides good performance by locating a value by applying a hash function to the key. Key mapping will pull each item out of the map and reinstall it using a hash of the new key. Of course, all this is doable, but it is quite a lot of work, and therefore it is best avoided.

+3
source

Source: https://habr.com/ru/post/1208834/


All Articles