We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eb6cf52 commit d0c9173Copy full SHA for d0c9173
containers/src/Data/Set/Internal.hs
@@ -886,7 +886,11 @@ intersection t1@(Bin _ x l1 r1) t2
886
#if (MIN_VERSION_base(4,9,0))
887
-- | The intersection of a series of sets. Intersections are performed left-to-right.
888
intersections :: Ord a => NonEmpty (Set a) -> Set a
889
-intersections (s :| ss) = Foldable.foldl' intersection s ss
+intersections (s0 :| ss) = List.foldr go id ss s0
890
+ where
891
+ go s r acc
892
+ | null acc = empty
893
+ | otherwise = r (intersection acc s)
894
895
-- | Sets form a 'Semigroup' under 'intersection'.
896
newtype Intersection a = Intersection { getIntersection :: Set a }
0 commit comments