[GHC] #3991: One function missing in Data.Map

GHC cvs-ghc at haskell.org
Thu Apr 15 00:58:30 EDT 2010


#3991: One function missing in Data.Map
---------------------------------+------------------------------------------
    Reporter:  plmday            |       Owner:  plmday           
        Type:  bug               |      Status:  new              
    Priority:  normal            |   Component:  libraries (other)
     Version:  6.12.1            |    Keywords:  containers       
          Os:  Unknown/Multiple  |    Testcase:                   
Architecture:  Unknown/Multiple  |     Failure:  Other            
---------------------------------+------------------------------------------
 Isn't the function '''adjustLookupWithKey''' missing in '''Data.Map'''?
 There are functions ending in '''LookupWithKey''' for both '''insert'''
 and '''update''' but not for '''adjust'''.

 adjustLookupWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a ->
 (Maybe a, Map k a)

 adjustLookupWithKey f k m[[BR]]
   ==> (Nothing, m) ''if'' k ''is not in'' m[[BR]]
   ==> (Just old, m) ''if'' f x ''is'' Nothing[[BR]]
   ==> (Just new, m') ''if'' f x ''is'' Just new, ''and'' m' ''being'' m
 ''adjusted''

 The same behavior could be simulated using library function and user
 defined function, but I it deserves an implementation.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3991>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list