In many years of OO programming I've understood what discriminated unions are, but I never really missed them. I've recently been doing some functional programming in C# and now I find I keep wishing I had them. This is baffling me because on the face of it, the concept of discriminated unions seems quite independent of the functional/OO dichotomy.
Is there something inherent in functional programming that makes discriminated unions more useful than they would be in OO, or is it that by forcing myself to analyse the problem in a "better" way, I've simply upped my standards and now demand a better model?
Also Java language enums can be used as a sort of implementation of discriminated unions.
– Roland Tepp Jul 13 '17 at 09:34