(no title)
islon | 3 years ago
var foo: (T | None) | None = None
Which None do you mean here?
This is just basic logic: (X or Y) or Y <=> X or Y
Untagged unions cannot model that. Contrast it with tagged unions:
var foo: Option<Option<T>> = Some(None)
var bar: Option<Option<T>> = None
Now you can reason about where the None means.
kaba0|3 years ago
Surely, if you want to distinguish between 3 states you need more data, hence my recommendation of Option<T?>