News for hackers. Stuff that matters.
Re:Why Generics? by olooney on Wednesday July 31, 2019 @03:35PM (#20577524)
What is HKT?
Re:Why Generics? by mrkeen on Wednesday July 31, 2019 @04:08PM (#20577930)
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.
Re:Why Generics? by icedchai on Wednesday July 31, 2019 @05:00PM (#20578492)
Thanks for the practical, plain English definition. As someone many years out of school, it is appreciated.
Re:Why Generics? by clhodapp on Wednesday July 31, 2019 @04:06PM (#20577905)
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).
Re:Why Generics? by sli on Wednesday July 31, 2019 @03:44PM (#20577629)
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 * -> * .

Re:Why Generics? by jsjolen on Wednesday July 31, 2019 @04:09PM (#20577946)
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?
Re:Why Generics? by mping on Wednesday July 31, 2019 @03:50PM (#20577706)
Higher Kinded Types
Re:Why Generics? by eslaught on Wednesday July 31, 2019 @03:37PM (#20577551)