Summary of containers patches

Johan Tibell johan.tibell at
Fri Sep 24 07:14:30 EDT 2010

On Fri, Sep 24, 2010 at 12:58 PM, Simon Peyton-Jones
<simonpj at> wrote:
> Can you give some examples to back up this claim?  I am skeptical

I can look into it again after ICFP.

I did spend some time trying to tease apart the performance
improvements we got from inlining foldl'. From what I remember, the
biggest gain from inlining is that the higher-order argument is known,
but there's some additional gain from unboxing the accumulator (and
some additional gain from inlining simple higher-order arguments like
(+) into the body of foldl').

> That’s what the auto-specialisation I described does.
> You can’t write a SECIALISE pragma in the libray for a type that is defined by the client.  This is very very common

Right, I think that's the reason we rely on INLINING pragmas so much.
Inlining gives us the effect of specialize, but at types not known to
the library author. I don't think we really want to force inlining,
but want to say something like this:

foldl' :: (a -> b -> a) -> a -> [b] -> a
foldl' = ...
{-# SPECIALIZABLE foldl' #-}

and then have foldl' be specialized in the client module at whatever
type it's called at, but only once for each type (instead of once per
call site).

-- Johan

More information about the Libraries mailing list