4 ms·
Rust's traits are a limited version of Haskell's type classes. They are more limited in at least two ways: 1. Rust's traits are unary relations (i.e., predicat
by ebingdom 4y ago
Rust's traits are a limited version of Haskell's type classes. They are more limited in at least two ways:
1. Rust's traits are unary relations (i.e., predicates) on types, whereas Haskell's type classes support relations of arbitrary arity ("multi-parameter type classes").
2. Rust's traits do not support higher kinds, so you can't define many things which are considered pretty basic to Haskell programmers (Functor, Monad, etc.).
But despite these limitations, Rust's traits are still great and better than what 99% of other languages have.