export toDescList from Data.Map
Christian.Maeder at dfki.de
Wed Sep 24 06:15:48 EDT 2008
Chris Kuklewicz wrote:
> I conjecture that the logic, if any exists, behind having the two names
> is so that the Data.Map API can be applied to several implementations.
> And in another implementation it may be most efficient or most lazy to
> return elements in unsorted order. So there is a "toList" which asks
> for the easiest conversion to a list, and a "toAscList" which asks for
> the sorted version.
if "toList" returned "elements in unsorted order" it would break the
abstraction: equal maps could return different list. So toList must
either be toAscList or toDescList.
> As for this proposal, I vote to have toDescList and foldlWithKey. This
> would likely simplify one of my uses of Data.Map.
+1 and foldrWithKey.
More information about the Libraries