They are related, but different concepts. An HKT is the type of a type constructor. An example described in another comment in this thread is if you want to define the map function on any collection C (in pseudo-Java),
C<B> map(C<A> coll, Function<A, B> fun)
Mapping over an Array would return an Array while mapping over a List would return a List. C<_> here is an HKT, the type of a type constructor with one argument.
In OOP a class is a description of what an object can do, often with a constructor that produces instances of the class with values as arguments. A type class is the same thing, but the constructor of a type class takes types as arguments. Type classes are useful because they allow defining functions for many types that share something without having to make the types inheritors of a common class (composition over inheritance basically).
For the example above I could define (pseudo Java) a type class like this,
and then if I want to define a function generic over anything that has a map I can do so by requesting both the thing and a Mappable of the thing,
C<B> foo(Mappable<C> inst, C<A> coll)
Then I can use the Mappable instance to call map over any coll instances. For example a generic "size" function could be defined like this [1],
C<B> foo(Mappable<C> inst, C<A> coll) {
var out = 0;
inst.map(coll, k -> {out++; return k});
return out;
}
So that function would be enough to prove that Mappable<C> implies that C has a size and you can then define a function that gives you Sizeable from Mappable, which is useful composition.
The example above is very boilerplate heavy because Java doesn't really support type classes but in Scala and especially Haskell the syntax is a lot cleaner.
[1] Usually you would use a fold here instead of a side effecting map.
That is a ("normal") kind `* -> *`. A Java `List<_>` or `Set<T>` would be a "normal/concrete" type constructor. In your example the problem is that `C` is a "generic" type constructor, so it has a higher (-order) kind, that takes a type constructor as argument (like `List<_>` or `Set<_>`) and constructs a type from this: `(* -> *) -> *`.
In OOP a class is a description of what an object can do, often with a constructor that produces instances of the class with values as arguments. A type class is the same thing, but the constructor of a type class takes types as arguments. Type classes are useful because they allow defining functions for many types that share something without having to make the types inheritors of a common class (composition over inheritance basically).
For the example above I could define (pseudo Java) a type class like this,
and then if I want to define a function generic over anything that has a map I can do so by requesting both the thing and a Mappable of the thing, Then I can use the Mappable instance to call map over any coll instances. For example a generic "size" function could be defined like this [1], So that function would be enough to prove that Mappable<C> implies that C has a size and you can then define a function that gives you Sizeable from Mappable, which is useful composition.The example above is very boilerplate heavy because Java doesn't really support type classes but in Scala and especially Haskell the syntax is a lot cleaner.
[1] Usually you would use a fold here instead of a side effecting map.