5 ms·
What is HKT?
by olooney 7y ago
What is HKT?
- deleted 7y ago[deleted]
- eslaught 7y agohttps://www.google.com/search?q=higher+kinded+types https://www.google.com/search?q=higher+kinded+types
- deleted 7y ago[deleted]
- sli 7y agoGenerics 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 * -> * .
- jsjolen 7y agoI'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?
- mping 7y agoHigher Kinded Types
- clhodapp 7y agoHigher-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).
- mrkeen 7y agoI'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.
- icedchai 7y agoThanks for the practical, plain English definition. As someone many years out of school, it is appreciated.