3 ms·
The first example has the duplication that the blogpost complains about. The second one doesn't use tagged union types, so you don't get the case statement cove
by vilhelm_s 10y ago
The first example has the duplication that the blogpost complains about. The second one doesn't use tagged union types, so you don't get the case statement coverage checking that the author wanted (if you want the tagged union, the task of converting it into a list is pushed to the client of the library).
- nightski 10y agoThe problem is that the case statement coverage isn't a valid assumption in this case and using a union type is putting a square peg in a round hole. HTML selects do allow duplicate names. He'd be better off just using a dictionary or list of name/value pairs and forgoing the union type altogether.