Dne 28.5.2013 12:32, Johannes Waldmann napsal(a):
Jose A. Lopes ist.utl.pt> writes:
unionWith :: Ord k => (a -> b -> c) -> Map k a -> Map
k b -> Map k c
what should be the result of
unionWith undefined (M.singleton False 42) (M.singleton True "bar") ?
Perhaps the generalized sign
Jose A. Lopes ist.utl.pt> writes:
> What makes it an interesting example ?
it shows that your proposed type for unionWith is not reasonable.
> why would you want to use undefined in that particular case?
the two argument maps have disjoint key sets,
so the combining function will never be call
Yes! intersectionWith is just what I needed.
In any case, coming back to your example, why would
you want to use undefined in that particular case?
What makes it an interesting example ?
Best,
Jose
On 28-05-2013 12:32, Johannes Waldmann wrote:
Jose A. Lopes ist.utl.pt> writes:
unionWi
Jose A. Lopes ist.utl.pt> writes:
> unionWith :: Ord k => (a -> b -> c) -> Map k a -> Map
> k b -> Map k c
what should be the result of
unionWith undefined (M.singleton False 42) (M.singleton True "bar") ?
perhaps you mean intersectionWith, which already has the type you want.
- J.W.
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 g