Type Classes

Type Classes

Share this post

Type Classes
Type Classes
Make invalid states representable.

Make invalid states representable.

We should model the state of a system using algebraic types and include states that are invalid.

Chris Martin's avatar
Chris Martin
Apr 25, 2023
∙ Paid
1

Share this post

Type Classes
Type Classes
Make invalid states representable.
2
Share

A favorite functional programming motto is “make invalid states representable.” If we can fully model the possible states of a system using algebraic types—including states that are invalid—then we can provide good error messages that describe why something is invalid, and we have more possibilities for recovering from error.

Share

A datatype: Configuration

For…

Keep reading with a 7-day free trial

Subscribe to Type Classes to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Mission Valley Software LLC
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share