On the unrolling of recursive functions applied to static arguments ('Inlining of loop breakers')

I would just like to point out that desugaring lists with build has been in GHC for quite a while (at least 16 years, as far as I can tell, from digging around). What I meant was that lookup participating in fusion is recent (which is relevant to your findFirstFold example, as it reimplements lookup and could be simplified).

That said, this note from the build desugaring code seems to have some lessons learned about how to avoid code bloat from doing this sort of thing.

3 Likes