Hacker News new | ask | show | jobs
by bsummer4 3889 days ago
It really doesn't have that much in common with Haskell either. It's designed by people who are not oblivious about PL stuff, but it's still pretty thoroughly in the C/C++ world in terms of both syntax and semantics.

It's not a bad thing, but Rust has very little in common with Haskell/Ocaml; aside from stealing a couple of good ideas.

1 comments

I would say Rust's type system has a lot more in common with Haskell/Ocaml than with C++, at least, although it's not quite as flexible as what Haskell offers (a lack of HKT is painful sometimes).
I think the similarities are mostly superficial. I mean it has (local) type inference, ADTs, and traits (which are sooooorta like type classes). But, as a Haskell programmer, the Rust type system feels very foreign.

No typeclasses (and associated goodness), GADTs, HKTs, Monadic IO, first class functions, generic deriving, higher rank types, existential type, etc. These are bread-and-butter features in day-to-day Haskell work. Rust's type system isn't powerful enough to build the vast majority of the tools that Haskell programmers use every day.

I don't mean this as a criticism; The Rust design seems solid. But different priorities lead to different trade-offs, and the end result is a very different type system.

Traits do a lot of what one can do with typeclasses (they're mostly just different names for the same thing), what differences are you thinking of?

Also, traits objects are existential types, and closures & functions are as first class as they are in Haskell (main difference is a bit more verbosity).