Commit 1e269bf4 authored by David Feuer's avatar David Feuer Committed by Austin Seipp

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
parent ef2d0279
......@@ -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 (++) []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment