| ▲ | louthy 2 days ago | |||||||
In C# you can implement SelectMany for a type and that gives this:
It is the equivalent to do-notation (was directly inspired by it). Here's an example from the language-ext Samples [1], it's a game of 21/pontoon.> I wrote what you might call an acid test for monad implementations a while back: https://jerf.org/iri/post/2928/ It's phrased in terms of tutorials but it works for implementations as well; you should be able to transliterate the example into your monad implementation, and it ought to look at least halfway decent if it's going to be usable. If I try to implement the test from your blog with Seq type in language-ext (using C#), then I get:
It yields:
Which I think passes your test.[1] https://github.com/louthy/language-ext/blob/main/Samples/Car... | ||||||||
| ▲ | jerf 2 days ago | parent [-] | |||||||
It looks like it. My claim was not (and is not) that C# can't implement it, but that what is discussed in the post does not. | ||||||||
| ||||||||