3 ms·
A more interesting question for me is: is there any reason why would I want to use Rust over Haskell on any task where Haskell is "fast enough"?
by pklausler 10y ago
A more interesting question for me is: is there any reason why would I want to use Rust over Haskell on any task where Haskell is "fast enough"?
- caconym_ 10y agoRust seems to be more lightweight and portable in general. I think the compiler uses far less memory (and IIRC has better cross-compilation support too). The binaries are much smaller and the runtime is simpler. Cargo is amazing and I have much more confidence in it to not give me build trouble. In particular, you get a test framework including doc tests for free; I know Haskell tools offer similar functionality but in practice the setup cost is far higher. Haddock is not bad, but it uses its own weird syntax; Rust's documentation system uses Markdown IIRC. Also, some things are just easier to write in an imperative language. I expect that the performance and memory use of Rust programs is also easier to predict and understand, though generally I think Haskell gets a lot of unfair criticism in that department. I haven't used Haskell in a while so some of the things I mentioned may have been improved upon since then. In particular, Stack may have grown up a bit.
- greatest-ape 10y agoThe syntax for accessing records (dot notation) is a lot nicer in Rust in my opinion. This makes a huge difference in practice, since I don't have to have ridiculously long accessor functions. Though I haven't learned how to use lenses in Haskell yet, they're supposed to alleviate some of that pain. I know you left out performance, but it's very nice to have code that can be easily profiled.
- paulddraper 10y agoProbably not. There's been a lot of work put into Haskell design, and a lot of work put into Rust design. A stand-out difference is that Rust put a lot of work into the borrow checker. But if a borrow checker is irrelevant (i.e. GC is fast/small enough), there isn't a huge reason. (To be clear, there are a number of differences, e.g. strict vs. lazy evaluation, but whether one is better than another is debatable.)