Map, Set libraries

Christian Maeder maeder at tzi.de
Thu Jun 2 09:54:01 EDT 2005


Serge D. Mechveliani wrote:
> As Jens Fisseler notes, I have made a confusion about
> 
> Set.elems, Set.toList, Set.setToList.

There is even Set.toAscList (although one may argue that should be
Set.toDistinctAscList)

I think the right choice is Set.toList (replacing setToList)

Is Set.elems just a (nicer?, useless?) synonym for Set.toList?
There are also Map.assocs and Map.toList being synonyms.

But Map.elems is different from Map.toList and Set.elems would only
correspond to Map.elems for some identity maps (not for the old set
implementation using maps with dummy elements "()")

Cheers Christian

P.S Map.insert indeed replaces existing values (and should be used
instead of addToFM with changed argument position for the input map)


More information about the Glasgow-haskell-users mailing list