Ask HN: What's the word for when your type 'compactly' represents your state?
When I represent a system's state, I am often searching for a type that neatly bijects to it. A dumb example is maybe, with a stoplight I might use a tagged union with 3 states (Red | Yellow | Green) over a struct with 3 booleans isRed, isYellow, isGreen, because the latter admits invalid states. A more realistic example is say, in a platformer when I see a boolean isJumping (in the air) and isFalling (in the air and also falling) when a union of (Grounded | Rising | Falling) might be more compact.
Likewise I might want to avoid a type having multiple values representing the same state. If I have a time series for temperature from a thermometer that's only sometimes on, I might prefer a list<optional<int>> over a list<pair<bool,int>> where the bool is the on state, since the int doesn't matter if when it's off.
I'm not saying that the compact representation is always better but there's certainly some utility or at least aesthetic quality. Is there a word for this? The words I've been using here have just been pulled out of the air.