🔥 Burn Fat Fast. Discover How! 💪

Zero-cost HKT in Rust This article propose the use of a quant | Technologique

Zero-cost HKT in Rust

This article propose the use of a quantified class constraints as an extension to type classes and as a solution to provide statically-sized and therefore statically compiled, and thus zero-cost (i.e. without run-time dynamic dispatching of types) higher-kinded types (HKT) in Rust!

http://blog.ielliott.io/sized-hkts/

Here's the code which is demonstrate the solution using quantified class constraints:

https://github.com/LightAndLight/sized-hkts

PS: There's also exist more earlier RFC proposal to addition of generic associated types (GAT) to the Rust type system as a solution for statically complied zero-cost abstractions of a higher kinds, which is still isn't resolved:

https://rust-lang.github.io/rfcs/1598-generic_associated_types.html

https://github.com/rust-lang/rust/issues/44265

#Rust