Skip to content

Deprecate Data.Set.fold and Data.IntSet.fold #1049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion containers-tests/benchmarks/IntSet.hs
Original file line number Diff line number Diff line change
@@ -27,7 +27,6 @@ main = do
, bench "map" $ whnf (IS.map (+ 1)) s
, bench "filter" $ whnf (IS.filter ((== 0) . (`mod` 2))) s
, bench "partition" $ whnf (IS.partition ((== 0) . (`mod` 2))) s
, bench "fold" $ whnf (IS.fold (:) []) s
, bench "delete" $ whnf (del elems) s
, bench "findMin" $ whnf IS.findMin s
, bench "findMax" $ whnf IS.findMax s
1 change: 0 additions & 1 deletion containers-tests/benchmarks/Set.hs
Original file line number Diff line number Diff line change
@@ -21,7 +21,6 @@ main = do
, bench "map" $ whnf (S.map (+ 1)) s
, bench "filter" $ whnf (S.filter ((== 0) . (`mod` 2))) s
, bench "partition" $ whnf (S.partition ((== 0) . (`mod` 2))) s
, bench "fold" $ whnf (S.fold (:) []) s
, bench "delete" $ whnf (del elems) s
, bench "findMin" $ whnf S.findMin s
, bench "findMax" $ whnf S.findMax s
4 changes: 4 additions & 0 deletions containers/changelog.md
Original file line number Diff line number Diff line change
@@ -28,6 +28,10 @@
* Various deprecated functions, whose definitions currently cause type errors,
have been removed. (Soumik Sarkar)

* `Data.Set.fold` and `Data.IntSet.fold` have long been documented as
deprecated and are now marked as such. They will be removed in a future
release.

### Bug fixes

* Make the package compile with MicroHs. (Lennart Augustsson)
5 changes: 2 additions & 3 deletions containers/src/Data/IntSet/Internal.hs
Original file line number Diff line number Diff line change
@@ -1180,10 +1180,9 @@ mapMonotonic f = fromDistinctAscList . List.map f . toAscList
Fold
--------------------------------------------------------------------}
-- | \(O(n)\). Fold the elements in the set using the given right-associative
-- binary operator. This function is an equivalent of 'foldr' and is present
-- for compatibility only.
-- binary operator.
--
-- /Please note that fold will be deprecated in the future and removed./
{-# DEPRECATED fold "Use Data.IntSet.foldr instead" #-}
fold :: (Key -> b -> b) -> b -> IntSet -> b
fold = foldr
{-# INLINE fold #-}
5 changes: 2 additions & 3 deletions containers/src/Data/Set/Internal.hs
Original file line number Diff line number Diff line change
@@ -1027,10 +1027,9 @@ mapMonotonic f (Bin sz x l r) = Bin sz (f x) (mapMonotonic f l) (mapMonotonic f
Fold
--------------------------------------------------------------------}
-- | \(O(n)\). Fold the elements in the set using the given right-associative
-- binary operator. This function is an equivalent of 'foldr' and is present
-- for compatibility only.
-- binary operator.
--
-- /Please note that fold will be deprecated in the future and removed./
{-# DEPRECATED fold "Use Data.Set.foldr instead" #-}
fold :: (a -> b -> b) -> b -> Set a -> b
fold = foldr
{-# INLINE fold #-}