Thus if they wanted to, they could (presumably) allow for a higher-order trait like Functor:
trait Functor {
fn map<a, b> : (|a| -> b) -> Self<a> -> Self<b>
}
(I'm not sure if that's valid syntax but you get the idea).As for existential types, they're an area of Haskell I haven't really explored that much, but they seem to be seen as a bit more of an advanced feature than their equivalents in Rust or Java. Not just because they require a GHC extension and additional keywords, but because there's a bit more theoretical overhead to understand how they work, while the presentation in Rust/Java is more intuitive and straightforward.
No, there's no first class "type level functions", i.e. you always need `Vec<T>`, and you can't ever write `Vec` by itself, which is what a true higher-order type is (and what Functor needs:
impl Functor for Vec { ... }
impl Functor for Option { ... }
Thus, your example isn't at all possible now or even in the near future.My point being that Rust restricts what one can do with higher-order types, but those types still exist and are expressible in the language. From a theoretical point of view, there doesn't seem to be any reason that they couldn't allow for traits on higher-kinded types -- they simply choose not to. Perhaps for performance reasons, or for simplicity, or for syntax or whatever, but I haven't seen any reason why they couldn't. That was the point that I was making.
Also, Haskell has existential types, which are exactly like Rust's trait objects.