Why not make it unlossy and have:<div><br></div><div>trans :: (Ord k, Ord a) => Map k a -> Map a (Set k)</div><div><br></div><div><br></div><div><br><div class="gmail_quote">On Thu, Jun 16, 2011 at 9:10 AM, Johan Tibell <span dir="ltr"><<a href="mailto:johan.tibell@gmail.com">johan.tibell@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="h5">On Thu, Jun 16, 2011 at 3:01 PM, Dmitri O.Kondratiev <<a href="mailto:dokondr@gmail.com">dokondr@gmail.com</a>> wrote:<br>
> Hi,<br>
> Data.Map has many great functions, yet I could not find the one that allows<br>
> from one map create another map where keys are values and values are keys of<br>
> the first one.<br>
> Something like:<br>
> transMap:: (Ord k, Ord a) => Map k a -> Map a k<br>
><br>
> Does such function exist?<br>
<br>
</div></div>Note that such a function would be lossy as there might be duplicate<br>
values in the map.<br>
<br>
Cheers,<br>
Johan<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div>