DavidArno / SuccincT

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

Enable equality comparison between Option and Maybe without casting #12

Closed chamook closed 7 years ago

chamook commented 7 years ago

So, I did this one a while ago, and I think I stopped while trying to come up with some kind of optimization for this and then got distracted by a million other things - now I've opened it up again (thanks to your reminder) and I'm honestly not sure what I was hoping to achieve.

AFAICT it passes the tests I setup, and seems to work as it should - but maybe I've missed something? Anyways, here is the code I have - I'll leave the judgement up to you :)

DavidArno commented 7 years ago

@chamook,

Adam, when I merge these changes, I end up with 18 tests that fail due to stack-overflow issues (as .Equals ends up recursively calling itself to resolve == calls. Do you have the same problem, or have I possibly merged the code incorrectly?

DavidArno commented 7 years ago

Merged PR, then made further enhancements to both keep Adam's additions working (now no need to cast between Option<T> and Maybe<T> when comparing them) and to enable all other tests still to pass.