Hacker News new | ask | show | jobs
by tome 1001 days ago
> I don't think Rust is over-hyped; almost everything I would have used Haskell for I do in Rust now.

As a Haskell fan this is very interesting! What sort of things do you write where you find Rust is a better fit? No code that I write in Haskell would be much better off without GC so I struggle to think of reasons Rust could be a better fit.

1 comments

The _language_ isn't a vast advantage; the type system is near-identical (which is important). Both have their advantages, but the ecosystem (tools, crates, documentation, educational material, community) is so much better and richer in Rust, and of course wrt. performance and memory frugality, Haskell doesn't even compete. (I haven't never been able to use Haskell professionally because of that, but I use Rust for work now).

Something things about Haskell have always boggled my mind: integer overflows aren't caught (so much for safety) and the argument for this choice was performance, but at the same time, the default string type is a linked list of characters. In fact, Haskell relies far too much on lists. In Rust, the rough equivalent is Vec and Vec slices, which takes less memory, is much easier to parallelize, and is just much faster overall.

It is true that garbage collected languages allow more flexibility than languages with an ownership model (~ linear types), but so far I have been able to work with this and the end result usually benefits (I haven't had to use interior mutability yet).

Disclaimer: I'm neither a Haskell or Rust expert, but probably equally intermediate in both.

Good to know about the ecosystem differences, thanks. Hopefully with some effort Haskell will be able to catch up there. And yes, Haskell gets some defaults wrong.

Regarding the type systems, they're definitely not near identical :) Haskell's is far more powerful. Perhaps you mean "the type systems are near identical for the kinds of programs I write". Speaking for myself, I could never work without a straightforward implementation of higher-kinded types, for example.

Well, now you need to define "Haskell". Haskell 98 has effectively the same type system as Rust (ignoring lifetimes). GHC does not. I guess I'm not a fan of the overly abstract types in later GHCs.
Normally by "Haskell" I'd mean "GHC", since that's the Haskell that everyone actually uses, but even Haskell 98 has higher-kinded types!