3 ms·
> type constructors take a type and return a type Ordinary constructors, which everyone here is familiar with, construct values. They may take some arguments,
by dllthomas 7y ago
> type constructors take a type and return a type
Ordinary constructors, which everyone here is familiar with, construct values. They may take some arguments, which are themselves values.
A type constructor constructs types. It may take some arguments, which are themselves types. List is a great example of a type constructor with one argument. `Bool` is a type, and arguably a type constructor with no arguments. `Either` is a type constructor with two arguments.
In C++, `Pair` is a type constructor with two arguments; although there are more constraints on how you can use it (or at least were last time I delved deep in C++).
An example of "abstraction over type constructors" would be something that lets you pass in a type constructor as an argument, giving different behavior (whether parametric or ad-hoc - sorry, more jargon...) depending on what you pick.