I have a map where multiple keys can map to the same value. I'd like to do reverse lookups, such that given a value, I get a list of all keys that map to this value.
Note that unlike
Data.Bimap
my map is not 1:1 but n :1.
Also, the reverse lookup should not take O(n) like running through all map entries would require but rather O(log n) or better like with a reverse index. The map will contain many ten-thousands of entries with a high load of add/remove/lookup operations.
Is such a data structure available in functional form (Haskell or Frege preferred)?