I have a discriminated union like this:
Type Result =
| Good of bool | Bad of bool
In many cases I know that result is Good. To unwrap the Result, I have to use pattern matching for just the Good option. As a result I get a warning (not an error) that says "Incomplete pattern match on this expression..". Is there a way to unwrap is without having to use pattern matching?
Good
I'd reconsider the design instead of 'casting' toGood
all the time. – CaringDevGood
and neverBad
, why return a type that could be either? Just return whatever value is wrapped by Good directly. The top-rated answer suggests introducing potential run-time failures and that's really a last-resort option. – Asik