intersection method
Intersect the key/value of two Map using combine
where the key is the same.
Implementation
Map<K, V> Function(Map<K, V> map) intersection(Eq<K> eq, Magma<V> combine) =>
(Map<K, V> map) => map.foldLeftWithKey<Map<K, V>>(Order.allEqual())(
{},
(acc, key, value) => lookup(key).match(
() => acc,
(v) => acc.upsertAt(eq)(key, combine(v, value)),
),
);