#2646: Expand folding options for Sets and Maps
---------------------------------+------------------------------------------
    Reporter:  sedillard         |       Owner:                   
        Type:  proposal          |      Status:  new              
    Priority:  normal            |   Component:  libraries (other)
     Version:  6.8.3             |    Severity:  normal           
    Keywords:  containers        |    Testcase:                   
Architecture:  Unknown/Multiple  |          Os:  Unknown/Multiple 
---------------------------------+------------------------------------------
 xref #2580 ,
 http://www.haskell.org/pipermail/libraries/2008-September/010653.html ,
 http://www.haskell.org/pipermail/libraries/2008-October/010782.html

 I've attached a patch which expands on Evan's changes and propagates them
 to `IntSet` and `IntMap`.

 Some (possibly controversial) changes of note :

     * Added foldr and foldl functions for the map types. This is
 redundant, but so is much of the interface. The argument to foldlWithKey
 has a strange type, (a -> key -> value -> a), that does not play nicely
 with flip and const. So I think its convenient to have foldl as well, and
 since we've got that why not throw foldr in too.

     * Specialized default implementations of foldl and foldr for Foldable
 class. This is perhaps better than exporting then from the map libraries.
 Data.Sequence does it this way, but the map libraries do not. If the API
 clutter is found to be unbearable then perhaps a major cleanup is in
 order, hiding all folds in the map/set modules and exporting them via
 Foldable.

 Shall I also add strict versions?

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2646>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to