remove a Set of keys from a Map

Milan Straka fox at ucw.cz
Sat Dec 10 14:00:24 CET 2011


Hi,

> I have (x :: Set key) and (m :: Map key a) and want to remove all
> keys and corresponding values from m that are in x. I could solve it
> efficiently with a
> 
> differenceSet :: Map key a -> Set key -> Map key a
> 
> or with a
> 
> Map.fromKeySet :: a -> Set key -> Map key a
> 
> or a
> 
> Map.fromKeySet :: (key -> a) -> Set key -> Map key a
> 
> but I did not find one of these functions in containers-0.4.2.

Map.fromSet :: (key -> a) -> Set key -> Map key a
will very likely be available in containers-0.5.

Cheers,
Milan Straka



More information about the Libraries mailing list