9 ms·
To some degree these are the same things, depending on the type system. But it might be easier to write a function accepting a list of size 3 than matching on a
by samus 2mo ago
To some degree these are the same things, depending on the type system. But it might be easier to write a function accepting a list of size 3 than matching on a constraint, which might get separated from the variable it annotates.
- inigyou 2mo agoThe difference is that (generally in programming languages) a type is something defined with a name while a constraint is ad-hoc. If you use types for everything you'll have to write a whole lot: this variable is a Size3List, this one is a Size5List, this one is a PrimePowersList.