Not sure why you avoided the term set, it's exactly what a type is, the set of all possible values. For example a union type in Typescript can be expressed as:
type A = number | string;
//same as
number = { n | n ∈ ℝ }
string = { s | s ∈ ∑* }
A = number ∪ string
Systems like LiquidHaskell even allow you to specify a subset of types for your functions, so you can e.g. only pass lists that are proven to not be empty to a function that extracts the first element.
The issue here is that sets have formal definition and if you say that types are sets you claim that types follow all formal rules for sets. I am not sure that this is the case, even that "simple" types are very similar to sets. I will need to read more to explain exact difference
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Not sure why you avoided the term set, it's exactly what a type is, the set of all possible values. For example a union type in Typescript can be expressed as:
Systems like LiquidHaskell even allow you to specify a subset of types for your functions, so you can e.g. only pass lists that are proven to not be empty to a function that extracts the first element.
The issue here is that sets have formal definition and if you say that types are sets you claim that types follow all formal rules for sets. I am not sure that this is the case, even that "simple" types are very similar to sets. I will need to read more to explain exact difference