[Haskell-cafe] Data.Map

Gracjan Polak gracjan at acchsh.com
Sun Apr 3 10:24:32 EDT 2005


Sebastian Sylvan wrote:
> On Apr 3, 2005 9:38 AM, Gracjan Polak <gracjan at acchsh.com> wrote:
> 
> 
>>insertList asclist map = union map (Data.Map.fromList asclist)
> 
> 
> How about:
> 
> insertList :: (Ord a) => Map a b -> [(a, b)] -> Map a b
> insertList = foldr (uncurry insert) 
>

Is there any reason why foldr is better than foldl here?

> 
> /S

-- 
Gracjan



More information about the Haskell-Cafe mailing list