2 ms·
I don't work much with extensible records myself, but maybe an easier solution is to invert it so the item variants are contained in a field: type Item = {
by hombre_fatal 3y ago
I don't work much with extensible records myself, but maybe an easier solution is to invert it so the item variants are contained in a field:
type Item = { name: String, year: Int, kind: Kind }
type Kind
= Cd { artist: String }
| Book { author: String }
| Shoes { size: Float }
https://ellie-app.com/mSVCN8dQqX8a1 https://ellie-app.com/mSVCN8dQqX8a1
Consider joining the Slack community: https://elmlang.slack.com https://elmlang.slack.com -- The #beginners channel is a great place to ask these kinds of questions.
- retepna 3y agoThank you, that's indeed a better way to model it!