diff options
author | David Feuer <David.Feuer@gmail.com> | 2014-10-21 15:02:03 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-10-21 15:02:03 -0500 |
commit | 1e269bf404fb2719bbe8d72154156ef275c9a6f9 (patch) | |
tree | ed9315394a7b713a04ee07749b451567aa9a46da /libraries/base | |
parent | ef2d027917ca7e5415ba5e9f3ff439beda89b3ea (diff) | |
download | haskell-1e269bf404fb2719bbe8d72154156ef275c9a6f9.tar.gz |
Make Data.List.concatMap fuse better
Summary:
Fix #9537 precisely as Joachim Breitner proposed in
http://www.haskell.org/pipermail/haskell-cafe/2011-December/097228.html
Reviewers: austin, nomeata
Reviewed By: austin, nomeata
Subscribers: thomie, carter, ezyang, simonmar
Differential Revision: https://phabricator.haskell.org/D348
GHC Trac Issues: #9537
Diffstat (limited to 'libraries/base')
-rw-r--r-- | libraries/base/GHC/List.lhs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libraries/base/GHC/List.lhs b/libraries/base/GHC/List.lhs index 7792eed524..2d01678691 100644 --- a/libraries/base/GHC/List.lhs +++ b/libraries/base/GHC/List.lhs @@ -717,6 +717,14 @@ lookup key ((x,y):xys) concatMap :: (a -> [b]) -> [a] -> [b] concatMap f = foldr ((++) . f) [] +{-# NOINLINE [1] concatMap #-} + +{-# RULES +"concatMap" forall f xs . concatMap f xs = + build (\c n -> foldr (\x b -> foldr c b (f x)) n xs) + #-} + + -- | Concatenate a list of lists. concat :: [[a]] -> [a] concat = foldr (++) [] |