I am coming from an OOP and learning FP and I have met alot of new concepts and this one of them. So what is a higher kind and how to achieve this with Kotlin ?
Edited--op is asking about Higher-kinded Type (HKT) and not higher order type.
AFAIK there is not any language-level support for HKT in Kotlin. Maybe someday? github.com/Kotlin/KEEP/pull/87
_Original Response: Have a look at en.wikipedia.org/wiki/Higher-order_function. There is a section there for Kotlin._
No, they are not the same. Edited answer.
Agnishom Chattopadhyay
Functional Programming Enthusiast
I do not know Kotlin, so I will code most of my answer in Haskell. However, I took a look at this blog and I am pretty sure that the idea is similar.
So, first off, values live in types. For example,
4 :: Int, meaning that the value4is of the typeInt. But, what isInt? We answer that question by saying thatInt :: *, meaning thatIntof the kind*(type).However, there is more to types than just the base types. For example,
[1, 2, 3] :: [] Int, indicating that[1, 2, 3]is a[](list) ofInts. But then, what exactly is[]? The answer to that question is[] :: * -> *, i.e,[]is a type constructor.So, in summary, such things are what we mean by higher kinded types. They are not types themselves, but functions on the space of types.
If you are interested in a very theoretical answer, checkout System F_omega