maeder at tzi.de
Fri Jun 3 07:51:20 EDT 2005
Serge D. Mechveliani wrote:
> I used to apply FiniteMap.addListToFM.
> Now, what is its best expression in ghc-6.4 ?
> Is this
> \ mp pairs -> Map.union (Map.fromList pairs) mp
> (the order of the arguments in Map.union is essential).
This looks fine to me. "best" is hard to meet. I'ld suggest:
foldr (uncurry Map.insert)
Efficiency should be tested, though.
Data.Map contains the following definition:
= foldlStrict ins empty xs
ins t (k,x) = insert k x t
More information about the Glasgow-haskell-users