News for hackers. Stuff that matters.
Re:Ask HN: How to be fluent in functional language speak? by dllthomas on Tuesday May 05, 2020 @05:45PM (#23085445)
> 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.

There are no comments on this comment yet.