(no title)
Mond_ | 29 days ago
To understand the difference, `String | String` is just `String`. It's a union, not a sum type. There's no tag or identifier, so you cannot distinguish whether it's the first or the second string.
If this sounds pedantic, this has pretty important ramifications, especially once generics get involved.
ekimekim|29 days ago
The mistake here is in how Option is defined, but it's a footgun you need to be aware of.
int_19h|28 days ago
nielsbot|29 days ago
JackYoustra|29 days ago
At least with |, you're attempting to model the state space. You're saying "this is one of these things." You might get the exhaustiveness wrong, but you're in the right ballpark. As it's normally done right now, the Swift developer with five optional properties is modeling state as "maybe this, maybe that, maybe both, who knows, good luck." which is just worse than a bar. If you need to discriminate explicitly, add a `__kind` field!
int_19h|28 days ago
At the same time, how often do you really need (Just (Just (Just ...)))?