3 ms·
Just a note, Rust's error handling is not monadic because Rust doesn't have monads because it doesn't have HKTs, I guess we could call it "reified" though.
by masklinn 11y ago
Just a note, Rust's error handling is not monadic because Rust doesn't have monads because it doesn't have HKTs, I guess we could call it "reified" though.
- GolDDranks 11y agoActually it is. Rust Option and Result types implement .and_then(), which is equivalent to bind. They are also equipped with many of the other things you'd expect of a monadic types. The thing is, Rust's type system is currently incapable of expressing an GENERAL monadic trait/interface, which it would be, if it had HKT. (That would allow implementing all the additional monadic util methods as trait default implementations, and having generic functionality applying to any monad.) Hopefully we get there someday.