Making Invalid States Unrepresentable 2: The algebra behind your types
·7 mins
Types are called algebraic because they obey arithmetic. Product types multiply, sum types add. Understanding this arithmetic explains why an enum with 5 variants is infinitely more precise than 4 boolean flags.