Module Set/FiniteMap

Christian Maeder maeder@Informatik.Uni-Bremen.DE
Sun, 28 Jul 2002 14:44:10 +0200


Hal Daume III wrote:
> 
> As long as we're on the "retrofit FiniteMap" discussion, in addition to
> splitting, etc, it would be really nice to have:
> 
>   composeFM :: Ord a, Ord b => FiniteMap a b -> FiniteMap b c
>                             -> FiniteMap a c
> 
> defined in the obvious way.
> 
> Also, something like:
> 
>   modifyFM :: Ord a => FiniteMap a b -> a -> (b -> b) -> FiniteMap ab
> 
> where the function is applied to element a in the fm if it exists.

I agree and further propose

  delSetFromFM :: Ord key => FiniteMap key elt -> Set key -> FiniteMap
key elt

or generalize 

  minusFM :: Ord key => FiniteMap key elt1 -> FiniteMap key elt2 
                                               -> FiniteMap key elt1

because elements in the second map are ignored anyway!

Cheers Christian