Continuations all the way down

Published: 2017-05-10
Words: 220

Here are the slides for my Lambda Jam talk, "Continuations all the way down."

It was originally going to be a collection of "why is it fast" anecdotes from popular Hackage libraries, since I know of several that observed significant improvements via CPS. When this happens, it could be due to the elimination of some incidentally complicated internal expression, either by something akin to fmap fusion (making a known simplification mandatory) or by tweaking the associativity. Improvements could also be chalked up to CPS producing expressions that suit GHC's rewrite rules slightly better. While CPS doesn't give you strictness out of the box, with a few little $!s littered around your ks you may find it easier to reign in errant thunks that churn up space. There's probably many other reasons CPS is used for performance!

Basically, there are a lot of very specific things that library authors use CPS for. I felt like it was way too hard to do a summary talk about libraries I didn't write. I'd rather do that as a series of "why is it fast" blog posts. So, this talk is about how a few popular techniques turn out to be just CPS, with scary names and practical consequences.

(Please don't email me about the BindK benchmark at the end. The screenshot is wrong.)