DavidArno / SuccincT

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

Accessing Union values directly. #42

Closed peter-majeed closed 6 years ago

peter-majeed commented 6 years ago

Similar to how we can imperatively get values from options via its value property, it's useful to be able to imperatively get values from unions.

peter-majeed commented 6 years ago

@DavidArno I added these helper methods mostly for testing. I found that using matchers were useful for most production code, but using Value<TResult> was nicer when trying to assert functionality in tests.

DavidArno commented 6 years ago

Thanks for the PR, Richard. I am very busy with other things at the moment though, so please forgive me if I take a week or so before property looking at it and merging.

peter-majeed commented 6 years ago

Thanks for getting back, @DavidArno. We have an interest in using this feature in some of our applications relatively soon, but I know it's starting to be the holiday time, so I don't mind waiting.