Question about RPITIT/async fn and HKTs

Hey folks,

I've seen the new announcement in the official blog regarding async fn/RPITIT. I'm glad that we will have this feature soon in stable but I also remembered this section in RFC#1522 which says:

One important usecase of abstract return types is to use them in trait methods.

However, there is an issue with this, namely that in combinations with generic trait methods, they are effectively equivalent to higher kinded types. (...)

So... does the announcement in the blog also mean that we get HKTs?


It reads to me AFIT/RPITIT is not a HKT, because RPITIT is more like a concrete return type instead of a abstract one. (Correct me if I'm wrong.)

AFIT is a mere sugar for PRITIT, and specifically two steps happen

Do GATs count as HKTs? I don't know. I haven't dug into HKT · baby steps yet.

But in step1, it says

we can return a specialized future for each impl of a trait for a given type.

so I think PRITIT doesn't provide the ability of being generic over something.

1 Like

Meanwhile I've tinkered around several hours and I always came in the situation where I had to reason about whole type families. I also found this article on GitHub from @RustyYato where he talks exactly about this. So it seems to me that HKTs are already possible in Rust when you build them yourself but there's still no native support for it eg through some special syntax or something like that even with Rust 1.75.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.