More speed please!

Simon Peyton-Jones simonpj at
Fri May 11 08:51:57 EDT 2007

| I'm replying to a rather old thread here, about unboxing in functions. Duncan
| had a continuation monad which passed around some data type that would be nice
| to unbox. You discussed strictness annotations in function types as a potential
| solution. I have a different tack on the problem which seems potentially
| useful. I've experimented with doing local defunctionalization on the module.

Interesting suggestion, Josef.  In general, local defunctionalisation would be an intersting transformation to try. I'm not sure how well it would scale: the larger the scope, the bigger the more distinct functions and the bigger the dispatch table.

Also your transformation is semantically transparent (no effect) whereas Duncan is prepared to add ! annotations that really make things stricter, just as ! annotations in data type decls do today.  So presumably he will get further than you will, because he is making more assumptions.

Meanwhile, I've thought a bit more about Duncan's idea.  One attractive aspect is that you can regard it as a direct extension of Haskell's existing mechanism of ! on data types, making the {-# UNPACK #-} pragma look inside function types as well as looking inside data types.  I like that. It makes it sounds less ad hoc than I previously thought.  I'll open a Trac ticket for this thread,


More information about the Glasgow-haskell-users mailing list