8

In a previous question I asked Why can the Monad interface not be declared in Java?. There, I received a comment from Brian Goetz saying that I should have called "higher order types" "higher kinded types".

Now, I read more about type systems and I understand the concept of higher kinded types. However, I am still confused by the terms. I tried to disambiguate them by myself using Google, however there does not seem to be a clear answer. Thus, my question is what is the exact meaning of the following terms:

  • higher order type
  • higher kinded type
  • higher order kind

Do all three terms exist? Is there a difference between them? What is the difference? Does the meaning vary between programming languages?

I also noticed that StackOverflow has multiple tags:

However, there is no tag wiki for both of them.

Community
  • 1
  • 1
Stefan Dollase
  • 4,530
  • 3
  • 27
  • 51

1 Answers1

4

Following this blog post, the term higher order type seems to be the common term for higher kinded type and higher rank type. higher order kind is probably a term that I just made up when I was confused.

Higher kinded type

With higher kinded types, it is possible to receive a type parameter that itself is a generic type:

interface Foo<T<_>> {
    T<String> get();
}

This is what is necessary to declare the Monad interface.

Higher rank type

With higher rank types, it is possible to receive a parameter whose type still contains unspecified type parameters:

interface Bar {
    void foobar(<E> List<E> list);
}

Unfortunately, higher rank type checking/inference is undecidable.

Stefan Dollase
  • 4,530
  • 3
  • 27
  • 51
  • 1
    It depends. Actually, rank-2 types are decidable, although not trivially. Anything higher is undecidable to my knowledge. – ThreeFx Nov 06 '16 at 19:18