intersectionSet, differenceSet

Andreas Abel andreas.abel at ifi.lmu.de
Thu Nov 15 12:14:32 CET 2012


Sounds ok, by why especially for Set.  Why not (also)

     Map.intersectionList :: Ord k => Map k a -> [k] -> Map k a
     Map.differenceList :: Ord k => Map k a -> [k] -> Map k a

? Screams for a generalization.

On 15.11.12 11:34 AM, Henning Thielemann wrote:
>
> When using the new Data.Map.fromSet function I encountered that I use it
> many times in connection with Map.intersection and Map.difference like so
>
>    Map.intersection m (Map.fromSet (const ()) s)
>    Map.difference m (Map.fromSet (const ()) s)
>
> Actually the element types of the second operands of Map.intersection
> and Map.difference are completely independent and the values of these
> maps are not touched. Thus I think that intersection and difference with
> a Set are the more natural operation. How about adding
>
>    Map.intersectionSet :: Ord k => Map k a -> Set k -> Map k a
>    Map.differenceSet :: Ord k => Map k a -> Set k -> Map k a
>
> to Data.Map?
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>

-- 
Andreas Abel  <><      Du bist der geliebte Mensch.

Theoretical Computer Science, University of Munich
Oettingenstr. 67, D-80538 Munich, GERMANY

andreas.abel at ifi.lmu.de
http://www2.tcs.ifi.lmu.de/~abel/



More information about the Libraries mailing list