3 ms·
In functional programming, a type is just a function that returns a list of possible values. It’s not a class.
by pyuser583 3y ago
In functional programming, a type is just a function that returns a list of possible values. It’s not a class.
- skybrian 3y agoConceptually, you can think of a type as a set of values, but no, it’s not how static type-checking is implemented. Some sets are very large (consider the set of all JSON values) and enumerating them isn’t useful.
- dragonwriter 3y ago> In functional programming, a type is just a function that returns a list of possible values Its literally not; there may be a language which does this or something close (actually, I’ve seen narrow, purpose-focussed relational languages where this is the case, and all types are enumerable), but it's definitely not generally the case in functional languages.