It actually does this in a bunch of cases; see Haskell's stream fusion[1] and rewrite rules in general[2] for examples.
However, there aren't any rewrite rules for list-based code, at least with the standard library. Rewrite rules are generally used for libraries designed explicitly with performance in mind like Vector and Bytestring; the standard String type and the Prelude don't fall into this category.
Obvious follow-up question: why does cabal not use more performance-oriented libraries? Does it have to avoid depending on anything because it's the dependency manager?
Comments
It actually does this in a bunch of cases; see Haskell's stream fusion[1] and rewrite rules in general[2] for examples.
However, there aren't any rewrite rules for list-based code, at least with the standard library. Rewrite rules are generally used for libraries designed explicitly with performance in mind like Vector and Bytestring; the standard String type and the Prelude don't fall into this category.
[1]: http://stackoverflow.com/questions/578063/what-is-haskells-s...
[2]: http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/rewri...
Obvious follow-up question: why does cabal not use more performance-oriented libraries? Does it have to avoid depending on anything because it's the dependency manager?