DavidArno / SuccincT

Discriminated unions, pattern matching and partial applications for C#
MIT License
267 stars 15 forks source link

Add positional pattern matching support to Option<T> #65

Closed DavidArno closed 4 years ago

DavidArno commented 4 years ago

Add the means to do something like:

var result = option switch {
    (Some, x) => x,
    (None, _) => 0
};

to the Option type via a deconstructor.

Note this will be a breaking change as the current (hasValue, value) deconstructor will have to be removed.

DavidArno commented 4 years ago

Done.