Abusing the algebra of algebraic data types – why does this work?

The ‘algebraic’ expression for algebraic data types looks very suggestive to someone with a background in mathematics. Let me try to explain what I mean. Having defined the basic types Product • Union + Singleton X Unit 1 and using the shorthand X² for X•X and 2X for X+X et cetera, we can then define … Read more