If I had them as a first-class language feature, would I use them more? What for?
If I had them as a first-class language feature, would I use them more? What for?
For example, in my biggest F# project I parse a local standard for public transport timetables. In that format a trip can either drive through a stop, drive around it or stop there at a particular time. With a sum type, I can represent all three of these cases without worrying about a value of that type having both "driving through" and a time set. When you've got a language that effortlessly allows something like this, you'll find uses for these paradigms.
1. Allows you to make failure scenarios intrinsic to your domain, and the compiler then is a tool for domain correctness.
2. It provides a beautiful symmetry between how you define your domain and how you operate on it. The syntax is even almost identical. The features "fit" incredibly well because of that.
Beyond that, with optionals and results defined as sum types you find that any time you're in a "It may explicitly give me nothing" or "It may explicitly give me an error" scenario these types are the first your reach for in your toolbag.
Sum types don't completely obviate classes, but they are a better tool than classes for several scenarios.