[Haskell-cafe] Generalizing unionWithKey, unionWith, ...

Jose A. Lopes jose.lopes at ist.utl.pt
Tue May 28 12:24:04 CEST 2013


Hello everyone,

unionWithKey and unionWith have the following types

unionWith :: Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
unionWithKey :: Ord k => (k -> a -> a -> a) -> Map k a -> Map k a -> Map k a

Since they are implemented by means of mergeWithKey,
wouldn't it be possible to generalize these functions to the
following types ?

unionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c
unionWithKey :: Ord k => (k -> a -> b -> c) -> Map k a -> Map k b -> Map k c

Cheers,
Jose

-- 
José António Branquinho de Oliveira Lopes
Instituto Superior Técnico
Technical University of Lisbon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130528/62e96f15/attachment.htm>


More information about the Haskell-Cafe mailing list