You might enjoy a language with refinement types. I know Scala has a library for this called refined, which I believe is a port from Haskell.
In summary it gives you compile time feedback on types with refinements, e.g. positive ints, negative ints, even ints, etc, and can be based on custom predicates.
In summary it gives you compile time feedback on types with refinements, e.g. positive ints, negative ints, even ints, etc, and can be based on custom predicates.