4 ms·
you can actually do them pretty easily in C# without language support anyways. for instance, the F# example from https://fsharpforfunandprofit.com/posts/design
by keithnz 5y ago
you can actually do them pretty easily in C# without language support anyways.
for instance, the F# example from https://fsharpforfunandprofit.com/posts/designing-for-correctness/ https://fsharpforfunandprofit.com/posts/designing-for-correc...
can be done in C# like
https://gist.github.com/keithn/ceeeed5f7eb567e1b2333747065d10dd https://gist.github.com/keithn/ceeeed5f7eb567e1b2333747065d1...
almost similar amount of code, however, no exhaustive checking. Not that I find that to be much of a problem, but it would be nice
- Smaug123 5y agoBut who needs sum types when you have the visitor pattern :troll_face: https://blog.ploeh.dk/2018/06/25/visitor-as-a-sum-type/ https://blog.ploeh.dk/2018/06/25/visitor-as-a-sum-type/
- keithnz 5y agowow.....that is one way to do it.....yes. I would hate to think what a system would look like with many sum types in it