
| > {-# INLINE f #-} | > f x y z = ... f x' y' z' ... | > | > into this: | > | > {-# INLINE f #-} | > f x y z = f' x y z | > where f' x y z = ... f' x' y' z' ... | > | > That is, shoving (all of) the recursion in a level. Then inlining f | > results in a fresh loop, which presumably can be specialized or | > optimized in various ways. | | This transformation is critical for performance of foldr and foldl('). | The versions in GHC's libraries are manually written in the latter | style. It's important if and only if one or more of the parameters is static -- that is, passed on unchanged. HTis is not the case in the example above. If you have g x y z = .... (g x y' z') ....x... then indeed it's sometimes a good plan to transform to g x y z = g' y z where g' y z = ....(g' y' z')...x.... because now you can inline g, and thereby specialise for the value of x at the call site. This is esp good if x is a function. Simon