export toDescList from Data.Map

Chris Kuklewicz haskell at list.mightyreason.com
Wed Sep 24 05:06:13 EDT 2008


> Me either.  On one hand, it's more api clutter.  Once you add it, it
> never goes away.  On the other hand, foldWithKey vs. foldlWithKey is
> just confusing.  But if there was some sort of consensus that default
> is low to high, then I wouldn't mind so much.  The unfortunate
> presence of both toList and toAscList seems to indicate a lack of
> consensus though (I think including both is silly too).

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.

As for this proposal, I vote to have toDescList and foldlWithKey.  This would 
likely simplify one of my uses of Data.Map.

-- 
Chris


More information about the Libraries mailing list