This is a good overview of the utility of higher kinded polymorphism in languages like Scala and Haskell. I think however the most important insight when considering this feature in regard to Rust is the contrast between what this blog post points out and what is true about Rust.
All flatMaps are the same
In Rust, this isn’t true! Let’s look at the flat_maps on Option, Result, Iterator, and Future:
// Option
fn and_then<U, F>(self, f: F) -> Option<U> where F: FnOnce(T) -> Option<U>;
// Result
fn and_then<U, F>(self, op: F) -> Result<U, E> where F: FnOnce(T) -> Result<U, E>;
// Iterator
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where F: FnMut(Self::Item) -> U,
U: IntoIterator;
// Future
fn and_then<F, B>(self, f: F) -> AndThen<Self, B, F>
where F: FnOnce(Self::Item) -> B,
B: IntoFuture<Error=Self::Error>,
Self: Sized;
These are not the same type signature at all (except for Option and Result). I am at a loss as to how these could usefully abstracted. I worry that Rust’s low level aspects makes its types too ‘leaky’ about memory layout and state for higher kinded polymorphism to be all that useful.