5 ms·
Why Rust though? It doesn't provide much in terms of an expressive type system when compared to Haskell, SML, OCaml, Idris. I like Rust for many reasons and it'
by cm3 11y ago
Why Rust though? It doesn't provide much in terms of an expressive type system when compared to Haskell, SML, OCaml, Idris. I like Rust for many reasons and it's a huge boon for more correct software produced by more people (aka those who don't use an Ada profile :D) but Rust's type system isn't something to weight heavier than OCaml's. There is at least one SML implementation with region types from what I understand. Need to look it up, but it was the implementation from that Dane whose name was something like Elsberg or something and which also had tracing and stuff. For SML I use the MoscowML REPL and MLton for executables. But I don't do much SML, unfortunately. In some ways it's nicer than OCaml.
- pcwalton 11y agoWhat features does SML or OCaml's type system have that Rust's doesn't? Haskell has higher-kinded type parameters and Idris has dependent types. But SML and OCaml don't even have typeclasses at all, much less higher kinds. Furthermore, what makes Rust's type system interesting isn't just its use of regions (which the ML Kit used); it's regions combined with inherited mutability plus the borrow check to maintain soundness.
- cm3 11y agoOCaml's module system is a nice tool for many cases that is only slowly getting into Haskell via Backpack but not there yet. So that's one. GHC 8.0 almost has dependent types and the expectation is feature completeness in 8.2, thought what's in 8.0 is already useful. I like and use Rust and the design decisions that led to a very capable region system that allows one to write data race free and memory correct code is excellent. Haskell doesn't have such a thing because it doesn't try avoid GC. I didn't do a point by point comparison of Rust expressiveness vs Haskell recently, but I don't remember it being close. Rafael might need to write a Rust for for Haskellers as an update of his "for OCamlers" post a while back.
- knz42 11y agoThe post is called "Rust for functional programmers" and contains side-by-side comparisons with both OCaml and Haskell. http://science.raphael.poss.name/rust-for-functional-programmers.html http://science.raphael.poss.name/rust-for-functional-program... you might be confusing it with the other post "Haskell for OCaml programmers"? It is a bit outdated but as far as I can see not inaccurate yet. I only plan to update it when HKTs make it to Rust.
- skorgu 11y agoHey, that's a really useful reference, thanks. I actually learned something about OCaml from it!
- LeonidasXIV 11y ago> But SML and OCaml don't even have typeclasses at all, much less higher kinds. There is a fun library[0] with a pretty good paper[1] on how to do that in OCaml :-) [0]: https://github.com/ocamllabs/higher https://github.com/ocamllabs/higher [1]: https://ocamllabs.github.io/higher/lightweight-higher-kinded-polymorphism.pdf https://ocamllabs.github.io/higher/lightweight-higher-kinded...
- cwzwarich 11y agoOCaml has higher-kinded types in the guise of modules, and so does SML with common extensions. I'm not completely sure what you're implying, but type classes aren't required for higher kinds. OCaml has a powerful module system, labeled and optional function parameters, row polymorphism, equirecursive types, and GADTs. Most of these features would be fairly difficult to add to Rust. OCaml also has a better track record with soundness issues than Rust, and more interesting fragments of the language have been formalized.
- mkehrt 11y agoIn MLs, you can often replace what would be a typeclass in haskell with idiomatic uses of functors (parameterized modules). It gets kind of hairy if you do it a lot, though.
- deleted 11y ago[deleted]
- pdpi 11y agoCompare rust head to head with Haskell and and it will come out of that fight sporting some serious bruises. But Rust's lifetimes are a genuinely interesting idea that you see nowhere else when people start discussing sophisticated type systems
- cm3 11y agoMLKit
- cm3 11y agoIf you want to talk about lazyness, I'd have to refer you to the discussion between Robert Harper and Lennart Augustsson in 2011 on Robert's blog.
- pklausler 11y agohttps://existentialtype.wordpress.com/2011/04/24/the-real-point-of-laziness/ https://existentialtype.wordpress.com/2011/04/24/the-real-po... ... is this what you mean? I revere Harper, but his anti-Haskell rants just seem unhinged to me.
- cm3 11y agoThanks, that's the post. I've heard bad things about Harper, but then he's an accomplished fellow, which doesn't mean he has to be nice. I only expect him to be truthful, is all. Maybe he's just ML's LISP zealot like the now deceased Dane whose name I forgot.
- Tomte 11y agoErik Naggum, from Norway.
- pauldirac137 11y agoHarper is nowhere near as bad, fortunately. No F-bombs, for one thing. Harper is opinionated, curmudgeonly and sometimes arguably unfair, but he always backs up his opinions with reasoned arguments. Even when you don't like the way he expresses himself, he always has something insightful to say.
- cm3 11y agoMLkit is the SML I was failing to recall.