"We discovered that we could get some easy optimizations by doing these kind of replacements by hand, but that might sometimes involve modifying library code; it was an obvious candidate for implementing in a compiler pass. Who would benefit from it? Anyone doing ordinary math with Doubles, Floats and Ints. It probably won't help you much for things you should be doing on a GPU, and it still has some limitations like not folding into lazy structures. Some other people here at Tsuru are keen to make plugins for optimizing parsing and serialization. We use increasing amounts of TH, and it's interesting that we could mix expressive compile-time DSLs with transparent optimizations. It'll be interesting to get this kind of thing into GHC. One advantage of doing it there rather than in a plugin would be more access to the full type dictionaries, so that (perhaps) these optimizations could be done on eg. any Num type rather than just a known set of primitives. In any case, doing it in a..."
- Conrad Parker