Annotation for unfolding wanted

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Tue Jul 31 10:51:46 EDT 2007


On Tue, 2007-07-31 at 10:36 -0400, Jan-Willem Maessen wrote:

> I think what's meant here is translating something like this:
> 
> {-# 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.

Duncan



More information about the Glasgow-haskell-users mailing list