4 ms·
Records are associative HLists: HList of pairs (fieldname, valuetype). Fieldnames are string singletons (in Haskell from 2012, at least), and do not have runtim
by thesz 7y ago
Records are associative HLists: HList of pairs (fieldname, valuetype). Fieldnames are string singletons (in Haskell from 2012, at least), and do not have runtime representation and/or cost. Specifying that code has to have this argument with these fields is as simple as providing HList lookups in it. You also can zip and unzip these associative lists, getting completely erasable field names and concrete representation of record.
I believe author somehow messed the part where his requirement considers machine representation. This is an implementation detail, BTW. Sometimes it is desirable to have as tight representation as possible, othertimes it is not.
I believe that it is quite possible to have associated type for HList records in the vector package style for unboxed vectors - vector represents array of structures as structure of arrays and for HList we can do something alike. Again, you can have it if you want it.