[Haskell-beginners] a problem with maps

Ertugrul Soeylemez es at ertes.de
Sat Jul 23 04:58:47 CEST 2011


Dennis Raddle <dennis.raddle at gmail.com> wrote:

> mapOutList :: Ord k => [(k,a)] -> Mpa k [a]
> mapOutList list = M.fromList $ map (second (: [])) list

I'm not sure that this really does what you want.  Rather something like
this:

    fromAmbList :: Ord k => [(k, a)] -> Map k [a]
    fromAmbList = M.fromListWith (++) . map (second pure)


Greets,
Ertugrul


-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/





More information about the Beginners mailing list