External Publication
Visit Post

H2JVM - A Haskell Library for writing JVM Bytecode

Haskell Community [Unofficial] June 4, 2026
Source

Sure; DList can do more, but for the common case of just needing to accumulate a list in the opposite order of the desired order of the result, it seems like overkill (both in terms of intelligibility and allocation).

I feel like people get the impression that using function composition is somehow leading to some aspect having zero overhead, but it isn’t. And in particular, the final toList is O(n), just like reversing a list. Either way you do it, it will have at least double the execution cost of just accumulating a list in the “wrong” order.

Generally with Chuch-encoding-like constructions, I think it’s cool that you can do it but that doesn’t mean you should; it’s slick but maybe not the best implementation.

Discussion in the ATmosphere

Loading comments...