<div dir="ltr"><div><div><div><div><div>Dear cafe,<br><br></div>What is the idiomatic way to "split" records into their natural keys and content in a data structure? For example, given a user:<br><br></div>data User = { username :: ByteString, hash :: ByteString, address :: Text, ... }<br><br></div>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<br><br></div><div>insert "John" (User "Jane" ...<br><br></div><div>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.<br><br></div><div><br></div><div>Regards,<br></div><div>Hon<br></div></div></div>