Hey, Elm 0.19 is out today!
As part of that, I did a bunch of rewrites on the official guide. I spent a while trying to make the presentation of types flow more naturally and emphasize important concepts more clearly. The finished result lives here. (I actually recommend folks reread the new version of the guide because I improved a lot of sections!)
Anyway, as I was writing, I started to find the name “union types” made the presentation less clear.
Theory
In general, people use type definitions less than I would expect.
The real point of a type is to model your situation very precisely. To make it impossible to represent invalid things. I wrote the Types as Sets appendix to try to say that in a way that I personally found helpful early on.
So my theory is that the term “union type” only emphasizes the fact that you can put different types together. That is true, but it is a really small part of what a type definition is about!
I am hoping that by saying “custom type” it will be clearer that it is for custom situations. You may not be putting anything together, but you can benefit from a custom type. Richard tested this out in a recent workshop and felt it helped a bit, so I am optimistic about this change.
Request
If you have any stuff online that mentions union types, please update to the term custom types when you get the chance. It’s no huge rush. People have lives and all! And if you are writing something new, definitely use the revised term to match the official guide. That is the term any newcomers will be using, and it’d be best if they do not need a history lesson to know what’s up!