So we have all these types like Int, Float, String, Map String Int, [Maybe String], etc. What do all these types have in common? Well, essentially, they're "normal" types where we can make a value for them. Just as values have types, types have "kinds". In this case, just as 4 : Int
, Int : *
, and just as "Hello" : String
, String : *
. That is to say, all these normal types (the types of plain old values) have kind *
.
Now, in OCaml, you have type parametricity, but only over types of kind *
. Let's give an example of a type that's not of kind *
.
Map : * -> * -> *
We apply this "type constructor" (which is a kind of "type function", just like constructors are a kind of function) to the type Int : *
.
Map Int : * -> *