Map for FGL

Christian Maeder maeder at tzi.de
Mon Jan 9 14:33:29 EST 2006


Adrian Hey wrote:
> 
> It'd be worth a look at to see what functions this provides that
> weren't provided by the old FiniteMap implementation, and whether or
> not these are still absent from Data.Map (I believe this was the
> original motivation for FGL having it's own private implementation in
> the first place).

splitFM :: Ord a => FiniteMap a b -> a -> Maybe (FiniteMap a b, (a, b))
combines delFrom and lookup

splitMinFM :: Ord a => FiniteMap a b -> Maybe (FiniteMap a b, (a, b))
combines splitFM and minFM

The above two are special. splitFM could be expressed using 
Data.Map.updateLookupWithKey (with one traversal), I think.

splitMinFM corresponds to Data.Map.deleteFindMin

Christian


More information about the Libraries mailing list