[Haskell-cafe] Data.Map: Values to keys and keys to values
Daniel Peebles
pumpkingod at gmail.com
Thu Jun 16 15:15:43 CEST 2011
Why not make it unlossy and have:
trans :: (Ord k, Ord a) => Map k a -> Map a (Set k)
On Thu, Jun 16, 2011 at 9:10 AM, Johan Tibell <johan.tibell at gmail.com>wrote:
> 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.
>
> Cheers,
> Johan
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110616/296bf8ff/attachment.htm>
More information about the Haskell-Cafe
mailing list