[commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Fix performance of Data.Sequence.filter (fixes #176) (199e1ce)

git at git.haskell.org git at git.haskell.org
Mon Apr 17 21:39:33 UTC 2017


Repository : ssh://git@git.haskell.org/containers

On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394
Link       : http://git.haskell.org/packages/containers.git/commitdiff/199e1ce65a13d67e89a30dd6b7aa0bc0a6a4f734

>---------------------------------------------------------------

commit 199e1ce65a13d67e89a30dd6b7aa0bc0a6a4f734
Author: Michael Snoyman <michael at snoyman.com>
Date:   Thu Mar 31 20:16:56 2016 +0300

    Fix performance of Data.Sequence.filter (fixes #176)


>---------------------------------------------------------------

199e1ce65a13d67e89a30dd6b7aa0bc0a6a4f734
 Data/Sequence.hs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Data/Sequence.hs b/Data/Sequence.hs
index 89616b6..c0986e5 100644
--- a/Data/Sequence.hs
+++ b/Data/Sequence.hs
@@ -2130,7 +2130,7 @@ partition p = foldl part (empty, empty)
 -- @xs@ and returns a sequence of those elements which satisfy the
 -- predicate.
 filter :: (a -> Bool) -> Seq a -> Seq a
-filter p = foldl (\ xs x -> if p x then xs |> x else xs) empty
+filter p = foldl' (\ xs x -> if p x then xs |> x else xs) empty
 
 -- Indexing sequences
 



More information about the ghc-commits mailing list