3 ms·
I hope Rust can get higher kinded types through higher ranked trait bounds but for types, not just lifetimes, which would be equivalent to HKTs in other languag
by satvikpendem 4y ago
I hope Rust can get higher kinded types through higher ranked trait bounds but for types, not just lifetimes, which would be equivalent to HKTs in other languages. I don't believe generic associated types are fully equivalent to HKTs necessarily but type level HRTBs should fill that gap.
And I'm also looking forward to that keyword generics initiative, hopefully that team can look at how OCaml implemented their algebraic effects system, not sure if it's totally comparable however.
- leshow 4y ago> I hope Rust can get higher kinded types through higher ranked trait bounds but for types, not just lifetimes, which would be equivalent to HKTs in other languages. I don't believe generic associated types are fully equivalent to HKTs necessarily but type level HRTBs should fill that gap. In service of what though? I love Haskell and HKTs, but Rust is a different language and I don't find myself actually reaching for HKTs, even when writing libraries. Just my personal opinion, I think adding these features would be to Rust's detriment. I am happy to do my exploration into more complex type level features in another language in order to not add everything and the kitchen sink to Rust.
- satvikpendem 4y agoIt's more like many features are almost there but not quite and then do something differently. GATs are almost HKT but not quite and they're Rust specific rather than based in a common theory like category theory that many languages implement. Keyword generics are also almost like algebraic effects but not quite. It's more that I want Rust features to go all the way rather than do something 80% and in a different way than what other languages might commonly do.
- Gwypaas 4y agoFrom what I have read GATs (Generic Associated Types) are a deliberate choice to not have to introduce HKTs. https://github.com/rust-lang/rust/pull/96709#issuecomment-1148852889 https://github.com/rust-lang/rust/pull/96709#issuecomment-11...
- satvikpendem 4y agoYeah I know, but I wish that weren't so.