4 ms·
Rust uses Hindley-Milner type inference. OCaml uses Hindley-Milner. Swift apparently uses a variant of the system with more features. None of these make use of
by mrkgnao 9y ago
Rust uses Hindley-Milner type inference. OCaml uses Hindley-Milner. Swift apparently uses a variant of the system with more features.
None of these make use of monads or anything rooted in category theory.
https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_sy...
HM is a type system that also gives you an algorithm to infer types without having to do the "List<Integer> foo = new ArrayList<Integer>()" dance from languages without type inference. That's it. It has nothing to do with category theory.
- steveklabnik 9y ago(Rust doesn't use Hindley-Milner, though the plan is to try to move closer to it in the future)
- mrkgnao 9y agoOh, thanks for the correction. It would appear that my knowledge is out of date: did Rust use something closer to H-M in the past? (Going off of https://github.com/rust-lang/rust/pull/15955 https://github.com/rust-lang/rust/pull/15955 here.)
- steveklabnik 9y agoFor more, see here: https://www.reddit.com/r/rust/comments/6fs5q9/language_servers_and_ides/dikywtc/ https://www.reddit.com/r/rust/comments/6fs5q9/language_serve... see aturon's reply about that PR/blog post. Rust has done almost everything in the past; I wouldn't be surprised if somewhere back in there it was actually HM. :)
- jolux 9y agoArguably optionals are monadic.
- mrkgnao 9y agoOptionals are also "applicative", but Haskellers used them for a long time before applicative functors became popular. A concept can support a certain way of thinking about it without everyone needing to think that way :)