 
            
            
            
            
                10 Dec
                
                    2011
                
            
            
                10 Dec
                
                '11
                
            
            
            
        
    
                7:16 a.m.
            
        * Henning Thielemann 
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.
You can implement e.g. fromKeySet as fromKeySet a = Map.fromAscList . map (, a) . Set.toAscList In practice, when conversion between Sets and Maps is needed often, I found it convenient (and efficient) to emulate "Set a" by "Map a ()". -- Roman I. Cheplyaka :: http://ro-che.info/