filter -package:base -package:unordered-containers -package:bytestring -package:text package:containers

Filter all values that satisfy some predicate.
filter (> "a") (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"
filter (> "x") (fromList [(5,"a"), (3,"b")]) == empty
filter (< "a") (fromList [(5,"a"), (3,"b")]) == empty
Filter all elements that satisfy some predicate.
Filter all values that satisfy the predicate.
filter (> "a") (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"
filter (> "x") (fromList [(5,"a"), (3,"b")]) == empty
filter (< "a") (fromList [(5,"a"), (3,"b")]) == empty
The filter function takes a predicate p and a sequence xs and returns a sequence of those elements which satisfy the predicate.
Filter all elements that satisfy the predicate.
Filter the entries whose keys are missing from the other map using some Applicative action.
filterAMissing f = Merge.Lazy.traverseMaybeMissing $
\k x -> (\b -> guard b *> Just x) <$> f k x
but this should be a little faster.
Filter the entries whose keys are missing from the other map.
filterMissing :: (k -> x -> Bool) -> SimpleWhenMissing x x
filterMissing f = Merge.Lazy.mapMaybeMissing $ \k x -> guard (f k x) *> Just x
but this should be a little faster.
Filter all keys/values that satisfy some predicate.
filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
Filter the entries whose keys are missing from the other map using some Applicative action.
filterAMissing f = Merge.Lazy.traverseMaybeMissing $
\k x -> (\b -> guard b *> Just x) <$> f k x
but this should be a little faster.
Filter the entries whose keys are missing from the other map.
filterMissing :: (k -> x -> Bool) -> SimpleWhenMissing k x x
filterMissing f = Merge.Lazy.mapMaybeMissing $ \k x -> guard (f k x) *> Just x
but this should be a little faster.
Filter all keys/values that satisfy the predicate.
filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"