type-systemshigher-kinded-typeshigher-order-types

Disambiguation of higher kinded type vs higher order type


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:

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.


Solution

  • 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.