
8 Jul
2016
8 Jul
'16
9:35 a.m.
Dear cafe, What is the idiomatic way to "split" records into their natural keys and content in a data structure? For example, given a user: data User = { username :: ByteString, hash :: ByteString, address :: Text, ... } Using map, a first choice would be Map ByteString User, but this leads to duplication of the username. And it is possible to make mistakes, such as insert "John" (User "Jane" ... What does cafe think? Is there any pattern for this? This is probably just a small nit in the overall architecture, but I'm curious to know the clean way to do it. Regards, Hon