I was wondering if there's a way to make something like an Int type that can only represent a certain subset of numbers (like 0 ~ 29) and have the compiler throw an error if you try to do anything else with it.
I know I could do something like type MoonPhaseDay = Day1|Day2| ... |Day29 but that doesn't scale over a larger range.
I'm trying to keep in mind the advice, "make impossible states impossible to represent". I could get by with an Int but I'm curious if there's a better way.