Summary of containers patches

Simon Peyton-Jones simonpj at
Fri Sep 24 07:35:19 EDT 2010

[beautiful quote marks, thank you]

| > 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,

Ah yes! But that is *quite different* from specialising only on the *type*!

| 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).

For overloaded functions, that is precisely what I'm proposing.

For foldl' I think you will get no benefit from specialising on the type; only from specialising on the actual function passed.  So in that case inlining probably really is the answer.


More information about the Libraries mailing list