Hacker News new | ask | show | jobs
by moomin 2514 days ago

    Go 3: Why HKT?
    Go 4: Why homoiconicity?
    Go 5: Why uniqueness and borrowing?
3 comments

I am ok with this progression.
It's all bolted on.
What is HKT?
I'll give the 'why' rather than the 'what'. In most mainstream languages you take a List<Int> and substitute for List<X> without changing the implementation of List. But there's another substitution you could have made, which is L<Int>. HKT allows you to parametrise L over Int, in the same way you were able to parametrise List over Int.
Thanks for the practical, plain English definition. As someone many years out of school, it is appreciated.
Higher-kinded types. Generics that take generics as parameters. They allow things like writing a function that both takes and returns any container type you can map over with different (defined) element types. Given how hard arity-0 generics have been to get into Go, I suspect that the chances of HKT making it are slim to none (but I think that the grandparent knows that and is just being funny).
Generics are to types what HKT are to type signatures. In functions, they usually map to arity. That is, an arity mismatch is are a higher-kinded type mismatch. An easy (if not totally accurate) way to view them is like doubly-generic types.

If you have some type A, it has the kind * . If you have some function from A -> B, it has the kind * -> * .

I've decided that it's the same as having a simply-typed lambda calculus with one type (*) and function types living inside of your type system. Is this correct at all?
Higher Kinded Types
So, ten years and Go will be production ready.