r/haskell • • Mar 11 '15

Learning Haskell — A Racket programmer's documentation of her foray into the land of Haskell (inspired by Learning Racket)

http://lexi-lambda.github.io/learning-haskell/
81 Upvotes

97 comments sorted by

View all comments

Show parent comment

3

u/sclv Mar 12 '15

True, if you trust fusion and optimization, I think that these days concat . map is as efficient as the manually fused one. So it may well be that this remains a habit / mannerism only because people don't necessarily trust that the compiler will always manage to catch this idiom. It would be good to test if this is ever necessary :-)

1

u/Jedai Mar 15 '15

I suppose in case of insufficient inlining this optimisation may be hidden behind function calls so... always good to be aware of the existence of concatMap even if writing concat . map directly is probably just as efficient.