Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
The most important family to abstract over with HKT is function pointers. Rust currently has massive problems with deriving Debug, Copy, Clone, ... for function pointers, even though they are just a usize internally. And if a struct contains a function pointer, you can't derive Debug, Copy, Clone, ... for that struct, no, you have to implement it manually. You'd either need to hack a special case into the compiler or solve the problem via HKT cleanly.
I was thinking of porting elm/parser to rust and I needed something like apply in order to implement the mechanism needed for the pipeline.
It's similar to how Arrow-KT implemented HKTs on top of Kotlin's type system. You have to pass concrete witnesses around there, though, which you don't have to in Rust. Rust's compiler can use traits to figure out which function to call (Kotlin lacked traits, but they're implementing generic interfaces now, something that might end up being quite similar) so you can forgo witnesses.