-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Higher kinded polymorphism #8922
Comments
cc me. I've been thinking a lot about this and have a vague plan. I think we'll want it going forward to make dealing with user-defined pointer types work out. I'll try to find the time to write up my plans shortly. |
/cc me |
Any updates on this? |
One idea I was toying around with today was that if we did have Higher Order Types, we could design the trait Writer<M> {
fn write(&mut self, buf: &[u8]) -> M<()>;
}
impl Writer<Identity> for MemWriter {
fn write(&mut self, buf: &[u8]) -> Identity<()> {
self.buf.push_all(buf);
Identity(())
}
}
impl FdWriter<IoResult> for FileWriter {
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
let len = libc::write(self.fd, buf.as_ptr());
if len == -1 {
Err(io_error_from_errno())
} else {
Ok(())
}
}
} |
Does anyone have a 'collection' on all the different discussions/blog posts about supporting HKT's in rust? Maybe a collection of relevant links that would be useful for implementing this feature? I think it would be really helpful if we started pooling our ideas together on how to implement HKT in rust. |
I don't think there have been that many. I know I at least have had a lot of thoughts and discussions but relatively little time to write them out. |
Should this be moved to the rfc issue tracker? |
@thehydroimpulse Yes -- please ping @nick29581 (nrc on IRC) |
This issue has been moved to the RFCs repo: rust-lang/rfcs#324 |
Rust doesn't support higher kinded polymorphism, despite being a common feature in many functional programming languages. As far as I know, it is a commonly requested feature from people in the FP crowd.
The text was updated successfully, but these errors were encountered: