[Haskell-cafe] Data.Map: Values to keys and keys to values

Johan Tibell johan.tibell at gmail.com
Thu Jun 16 15:10:02 CEST 2011

On Thu, Jun 16, 2011 at 3:01 PM, Dmitri O.Kondratiev <dokondr at gmail.com> wrote:
> Hi,
> Data.Map has many great functions, yet I could not find the one that allows
> from one map create another map where keys are values and values are keys of
> the first one.
> Something like:
> transMap:: (Ord k, Ord a) => Map k a -> Map a k
> Does such function exist?

Note that such a function would be lossy as there might be duplicate
values in the map.


More information about the Haskell-Cafe mailing list