
#8092: Map.unionWithMaybe -------------------------------------------+------------------------------- Reporter: sjcjoosten | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.6.3 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Easy (less than 1 hour) | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: -------------------------------------------+------------------------------- for Data.Map, I needed a "unionWithMaybe" function for my sparse system of linear equations (unionWithMaybe :: Ord k => (a -> a -> Maybe a) -> Map k a -> Map k a -> Map k a). My usage: (.+.) = Map.unionWithMaybe (\a b->case a+b of {0->Nothing;s->Just s}) (I do not think Map.unionWithMaybe can be expressed in terms of other functions without loosing performance, so I recon it would be a nice addition to the library.) I built this function myself by modifying the Data.Map implementation, but it would be nice to see it in the official version of Data.Map. Here is the file including the modifications I made to it. Feel free to use it, I will agree to whatever license you need to make it public. (PS: this is the first time I return modified source code to the maintainer, feel free to instruct me on how to do this in the future.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8092 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8092: Map.unionWithMaybe -------------------------------+------------------------------------------- Reporter: sjcjoosten | Owner: Type: feature | Status: closed request | Milestone: Priority: normal | Version: 7.6.3 Component: | Keywords: libraries/base | Architecture: Unknown/Multiple Resolution: wontfix | Difficulty: Easy (less than 1 hour) Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | -------------------------------+------------------------------------------- Changes (by igloo): * status: new => closed * resolution: => wontfix Comment: Thanks for the suggestion. However, please see http://www.haskell.org/haskellwiki/Library_submissions for the process for proposing changes to the libraries. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8092#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC