summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2022-03-21 23:58:58 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-23 13:44:46 -0400
commite6585ca168ba55ca81a3e6cd7221707719b7fa56 (patch)
tree9bc849909746c254e00113e10f078dd77f87ca8a
parente3f60577b5c513ae9c7bc6dc70c95c3e2762fa6c (diff)
downloadhaskell-e6585ca168ba55ca81a3e6cd7221707719b7fa56.tar.gz
Define filterOut with filter
filter has fusion rules that filterOut lacks
-rw-r--r--compiler/GHC/Utils/Misc.hs4
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/GHC/Utils/Misc.hs b/compiler/GHC/Utils/Misc.hs
index 06a784dba7..986d95144e 100644
--- a/compiler/GHC/Utils/Misc.hs
+++ b/compiler/GHC/Utils/Misc.hs
@@ -228,9 +228,7 @@ secondM f (x, y) = (x,) <$> f y
filterOut :: (a->Bool) -> [a] -> [a]
-- ^ Like filter, only it reverses the sense of the test
-filterOut _ [] = []
-filterOut p (x:xs) | p x = filterOut p xs
- | otherwise = x : filterOut p xs
+filterOut p = filter (not . p)
partitionWith :: (a -> Either b c) -> [a] -> ([b], [c])
-- ^ Uses a function to determine which of two output lists an input element should join