<div dir="ltr">Hi,<br><br>I was wondering what the best way to represent a 'subset' type relationship would be. The use case I'm looking at is where the subset would be a user selection, so a filter would not be appropriate.<br>
<br>For example, say I have something like:<br><br>type Order = [OrderItem]<br>type OrderItem = OrderItem { qty :: Int, product: Product }<br><br>Now I'd like the user to be able to select a number of items (e.g., priority shipping, gift wrapping)<br>
<br>One possible way I can see is to add extra fields to the OrderItem record, but this seems like it would not be easy to extend.<br><br>It doesn't seem like using [Product] would be appropriate as if the Product is updated it will need to be updated in both the OrderItem list and in the subset.<br>
<br>Another approach would be to use a ProductIdType in place of Product, then look up the actual Product as needed.<br><br>Are there other (and better) ways to do this?<br><br>Thanks,<br>Levi<br></div>