I wonder if there's a way to efficiently implement it without resorting to monomorphization?
A function that's polymorphic can be transformed into a more primitive (say C or assembly) function that gets extra arguments that carry the "shape" of the type variable (think of sizes, pointers vs. values, etc.). Is there a similar strategy for these polymorphic records?
I see two issues:
1. The offset of any particular field in the record is unknown at compile time
2. The size of the record itself is unknown at compile time (but this should be trivial as an extra argument.)