codegen hlist workaround

This implements the suggested performance workaround for HLists in the code generator and enables and extends the corresponding test.

review by @szeiger