Skip to content

Commit

Permalink
Fix Stream.deleteFirstsBy
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyaov committed Nov 5, 2024
1 parent 92c2430 commit 963ac73
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/src/Streamly/Internal/Data/Stream/Top.hs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ sortedIntersectBy cmp (Stream stepa ta) (Stream stepb tb) =
--
-- >>> f xs ys = Stream.fold Fold.toList $ Stream.deleteFirstsBy (==) (Stream.fromList xs) (Stream.fromList ys)
-- >>> f [1,2,2,3,3,5] [1,2,2,3,4]
-- [2,3,5]
-- [3,5]
--
-- The following holds:
--
Expand Down Expand Up @@ -365,9 +365,9 @@ deleteFirstsBy eq s2 s1 =
-- It reverses the list but that is fine.
let del x =
List.foldl' (\(ys,res) y ->
if x `eq` y
if not res && x `eq` y
then (ys, True)
else (x:ys, res)) ([], False)
else (y:ys, res)) ([], False)
g (ys,_) x =
let (ys1, deleted) = del x ys
in if deleted
Expand Down

0 comments on commit 963ac73

Please sign in to comment.