Hi,
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.
For example, say I have something like:
type Order = [OrderItem]
type OrderItem = OrderItem { qty :: Int, product: Product }
Now I'd like the user to be able to select a number of items (e.g., priority shipping, gift wrapping)
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.
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.
Another approach would be to use a ProductIdType in place of Product, then look up the actual Product as needed.
Are there other (and better) ways to do this?
Thanks,
Levi