jargon

Design patterns·Functional ideas that went mainstream

you added a fifth case to the type and the build failed in nine places, which is exactly what you wanted.

Exhaustiveness checking

Also calledexhaustive match, total match, non-exhaustive match error

A compiler check that every case of a closed type is handled, failing the build when one is missed. It is the mechanism that turns a sum type from documentation into a guarantee, and it is the single strongest argument for modelling states as types rather than as strings or flags. Without it, adding a case is a search; with it, the compiler produces the list.

Commonly confused with