[Haskell-beginners] a problem with maps

Christian Maeder Christian.Maeder at dfki.de
Sat Jul 23 16:08:25 CEST 2011


Am 23.07.2011 03:40, schrieb Dennis Raddle:
...
> listOutMap :: Ord k => Map k [a] -> [(k,a)]
> listOutMap m = concatMap (\(k,a) -> zip (repeat k) a) (M.toList m)
...

instead of "zip" and "repeat" I prefer just "map":

     "\ (k, as) -> map (\ a -> (k, a)) as"

(and don't bother to switch on TupleSections for "(k,)")

C.



More information about the Beginners mailing list