@@ -85,6 +85,8 @@ module Data.HashMap.Strict.Refined
85 , differenceWith
85 , differenceWith
86 , differenceWithKey
86 , differenceWithKey
87 , PartialDifferenceProof(..)
87 , PartialDifferenceProof(..)
88+ , Common.intersection
88 , intersectionWithKey
90 , intersectionWithKey
89 , IntersectionProof(..)
91 , IntersectionProof(..)
90 -- * Traversal
92 -- * Traversal
@@ -406,6 +408,17 @@ differenceWithKey f (HashMap m1) (HashMap m2) = SomeHashMapWith
406 (HashMap.mapWithKey (,) m2))
408 (HashMap.mapWithKey (,) m2))
407 $ PartialDifferenceProof unsafeSubset unsafeSubset
409 $ PartialDifferenceProof unsafeSubset unsafeSubset
411+-- | Return the intersection of two maps with the given combining function.
413+ :: forall s t k a b c. Hashable k
417+ -> SomeHashMapWith (IntersectionProof 'Hashed s t) k c
418+intersectionWith f (HashMap m1) (HashMap m2) = SomeHashMapWith
419+ (HashMap $ HashMap.intersectionWith f m1 m2)
420+ $ IntersectionProof unsafeSubset unsafeSubsetWith2
409-- | Return the intersection of two maps with the given combining function.
422-- | Return the intersection of two maps with the given combining function.
411-- You can use 'andLeft' and 'andRight' to obtain @'Key' s k@ and @'Key' t k@
424-- You can use 'andLeft' and 'andRight' to obtain @'Key' s k@ and @'Key' t k@