Skip to content

Commit

Permalink
Fix test and Haddock tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
meooow25 committed Nov 20, 2024
1 parent d5053e6 commit ae6b52d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion containers-tests/tests/intmap-properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,7 @@ prop_filterWithKey :: Fun (Int, Int) Bool -> IMap -> Property
prop_filterWithKey fun m =
valid m' .&&. toList m' === Prelude.filter (apply fun) (toList m)
where
m' = filterWithKey (apply2 fun) m
m' = filterWithKey (applyFun2 fun) m

prop_partition :: Fun Int Bool -> [(Int, Int)] -> Property
prop_partition p ys = length ys > 0 ==>
Expand Down
6 changes: 3 additions & 3 deletions containers/src/Data/IntMap/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2641,12 +2641,12 @@ filter p m

-- | \(O(n)\). Filter all keys that satisfy some predicate.
--
-- > filterKeys (> 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
--
-- @
-- filterKeys p = 'filterWithKey' (\k _ -> p k)
-- filterKeys p = 'filterWithKey' (\\k _ -> p k)
-- @
--
-- > filterKeys (> 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
--
-- @since FIXME

filterKeys :: (Key -> Bool) -> IntMap a -> IntMap a
Expand Down
7 changes: 3 additions & 4 deletions containers/src/Data/Map/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2947,13 +2947,12 @@ filter p m

-- | \(O(n)\). Filter all keys that satisfy the predicate.
--
-- > filterKeys (> 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
-- > filterKeys (> 4) == filterWithKey (\k _ -> k > 4)
--
-- @
-- filterKeys p = 'filterWithKey' (\k _ -> p k)
-- filterKeys p = 'filterWithKey' (\\k _ -> p k)
-- @
--
-- > filterKeys (> 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
--
-- @since FIXME

filterKeys :: (k -> Bool) -> Map k a -> Map k a
Expand Down

0 comments on commit ae6b52d

Please sign in to comment.