1 patch for repository http://darcs.haskell.org/packages/containers: Sun Aug 15 12:28:52 CEST 2010 Johan Tibell * Add strict versions of insertWith and insertWithKey to IntMap New patches: [Add strict versions of insertWith and insertWithKey to IntMap Johan Tibell **20100815102852 Ignore-this: 5cd198a770125e418918c030059982f3 ] { hunk ./Data/IntMap.hs 420 insertWith f k x t = insertWithKey (\_ x' y' -> f x' y') k x t +-- | Same as 'insertWith', but the combining function is applied strictly. +insertWith' :: (a -> a -> a) -> Key -> a -> IntMap a -> IntMap a +insertWith' f k x t + = insertWithKey' (\_ x' y' -> f x' y') k x t + -- | /O(min(n,W))/. Insert with a combining function. -- @'insertWithKey' f key value mp@ -- will insert the pair (key, value) into @mp@ if key does hunk ./Data/IntMap.hs 448 | otherwise -> join k (Tip k x) ky t Nil -> Tip k x +-- | Same as 'insertWithKey', but the combining function is applied strictly. +insertWithKey' :: (Key -> a -> a -> a) -> Key -> a -> IntMap a -> IntMap a +insertWithKey' f k x t + = case t of + Bin p m l r + | nomatch k p m -> join k (Tip k x) p t + | zero k m -> Bin p m (insertWithKey f k x l) r + | otherwise -> Bin p m l (insertWithKey f k x r) + Tip ky y + | k==ky -> let x' = f k x y in seq x' (Tip k x') + | otherwise -> join k (Tip k x) ky t + Nil -> Tip k x -- | /O(min(n,W))/. The expression (@'insertLookupWithKey' f k x map@) -- is a pair where the first element is equal to (@'lookup' k map@) } Context: [Add a local type signature simonpj@microsoft.com**20100730124447 Ignore-this: b581d3f2c80a7a860456d589960f12f2 ] [Add type signature in local where clause simonpj@microsoft.com**20100727151709 Ignore-this: 5929c4156500b25b280eb414b508c508 ] [Fix Data.Sequence's breakr, and add a test for it; fixes trac #4157 Ian Lynagh **20100704140627] [Fix proposal #4109: Make Data.Map.insertWith's strictness consistent Ian Lynagh **20100615133055] [Tweak layout to work with the alternative layout rule Ian Lynagh **20091129154519] [Disable building Data.Sequence (and dependents) for nhc98. Malcolm.Wallace@cs.york.ac.uk**20091124025653 There is some subtlety of polymorphically recursive datatypes and type-class defaulting that nhc98's type system barfs over. ] [Fix another instance of non-ghc breakage. Malcolm.Wallace@cs.york.ac.uk**20091123092637] [Add #ifdef around ghc-only (<$) as member of Functor class. Malcolm.Wallace@cs.york.ac.uk**20091123085155] [Fix broken code in non-GHC branch of an ifdef. Malcolm.Wallace@cs.york.ac.uk**20091123084824] [doc bugfix: correct description of index argument Ross Paterson **20091028105532 Ignore-this: 9790e7bf422c4cb528722c03cfa4fed9 As noted by iaefai on the libraries list. Please merge to STABLE. ] [Bump version to 0.3.0.0 Ian Lynagh **20090920141847] [update base dependency Ross Paterson **20090916073125 Ignore-this: ad382ffc6c6a18c15364e6c072f19edb The package uses mkNoRepType and Data.Functor, which were not in the stable branch of base-4. ] [add fast version of <$ for Seq Ross Paterson **20090916072812 Ignore-this: 5a39a7d31d39760ed589790b1118d240 ] [new methods for Data.Sequence (proposal #3271) Ross Paterson **20090915173324 Ignore-this: cf17bedd709a6ab3448fd718dcdf62e7 Adds a lot of new methods to Data.Sequence, mostly paralleling those in Data.List. Several of these are significantly faster than versions implemented with the previous public interface. In particular, replicate takes O(log n) time and space instead of O(n). (by Louis Wasserman) ] [Fix "Cabal check" warnings Ian Lynagh **20090811215900] [TAG 2009-06-25 Ian Lynagh **20090625160202] Patch bundle hash: 251d336649f909b4d97ef206ae74c48fb193981b