[Haskell-cafe] Data.Map

Gracjan Polak gracjan at acchsh.com
Sun Apr 3 03:38:11 EDT 2005

Hi all,

As I tried to convert some of my code to newer libraries comming with 
GHC 6.4, I would like to share two things with you:

I noticed that there are two functions missing: deleteList and
insertList. The first one is easy with foldl:

deleteList list map = foldl (flip Data.Map.delete) map list

Second one is even shorter:

insertList asclist map = union map (Data.Map.fromList asclist)

Still I find both of them useful also execution speed seems to be of 
some concern here. Why generate temporary map just to join it with 
second in a moment? Isn't it slower?

Also why Data.Map.lookup and Data.Map.findWithDefault? Why not

Besides, I really like new library :)


More information about the Haskell-Cafe mailing list