Higher ranked types is some form of higher order generics, but is not the same as higher kinded types (nested generics).
A typical situation occurs, if we want to apply a length function to a collection of heterogenous types. I will present it here in Haskell syntax.
The length function is itself polymorphic:
length::[T] -> int
Then we deine an apply function as:
With ([S],[R]), we assume that apply take as its second argument a tuple with two elements which are may of different type S \ne R.
The apply function above would not compile as T do not have to be match S or R. In order to solve the problem above, we had to describe the type parameter T has higher order generic. Haskell do it by the forall keyword with
apply:: (forall T. [T]->int)->([S],[R])->(int,int)
Now, we have the guarantee that that our (higher order) type parameter T will match the type parameters S and R. The apply function is a rank-2 type (function) which is guaranteed to be decidable for type inference. For ranked higher order types with rank>2, the type inference becomes undecideable, but additional type annotations would help in certain cases.
I hope, that I have not done any mistake.
Are there any plans, at least for rank-2 types, to support this in Future?