[Haskell-cafe] dear traversable

Henning Thielemann lemming at henning-thielemann.de
Sat Jul 31 02:30:30 EDT 2010


On Fri, 30 Jul 2010, Ben wrote:

> dear traversable geniuses --
>
> i am looking for "better" implementations of
>
> unzipMap :: M.Map a (b, c) -> (M.Map a b, M.Map a c)
> unzipMap m = (M.map fst m, M.map snd m)

Maybe:

    mapPair (M.fromAscList, M.fromAscList) $
    unzip $ map (\(a,(b,c)) -> ((a,b), (a,c))) $ M.toAscList m


More information about the Haskell-Cafe mailing list