export toDescList from Data.Map

Evan Laforge qdunkan at gmail.com
Mon Sep 8 18:46:59 EDT 2008


So, I mentioned this a long time ago but didn't get any responses and
then I got distracted.  So this time I added a ticket and patch and
everything:  2580

Here's the text:
It's even implemented, but not exported. Without this, there's
apparently no way to iterate over a map from high to low, since foldl
is also not exported.


Also, I implemented a toDescList for IntMap, and could do the same for
Set, and could add those patches, if people agree it's a good idea.

In addition, is there any problem with exporting foldl aka descending
for the three modules?  I implemented a foldl for IntMap and it seems
to work, but I'd want someone smarter to look for problems with it.
In addition, Set and Map are inconsistent with folds:  Set exports
'fold' and says "no order is guaranteed", but it's just defined to
foldr, which is in ascending order.  Set.foldr itself is not exported.
 Meanwhile, Map also exports fold, but heavily implies from the doc
that it's guaranteed to be ascending.

Would it restrict implementation changes too much to export a
descending fold for all three?  Other languages that have tree
oriented general purpose maps all let you start anywhere and iterate
in either direction.

Anyway, is 2-3 weeks ok for discussion period?  The library submission
wiki doesn't say how long.


More information about the Libraries mailing list