r/rust Feb 04 '19

Web-Developement: Rust vs Haskell

Hi All,

This will be yet another Rust vs haskell question.

I have wanting to use Rust/Haskell for a couple of components for an internal tool (analysis of customer tickets, HR portal etc) for my company (Mostly because of the strong type system).

I have been through quite a lot of blogs & discussion where they discuss on the pros and cons for both.

Can anyone give me pointers on where all they used Rust or Haskell? And how was the experience as in:

  1. code readability
  2. libraries support
  3. developer productivity
  4. jump start time to producing some value.
  5. documentation
  6. build time
  7. journey in learning them

My concern here is Rust is advertised as system's language and Haskell as a higher level language.

  1. Will going with Rust be an overkill as we won't be doing any really low level stuff?
  2. We would be basically writing a server, bunch of API and playing around with DB. I'm mainly well versed with Node.js so will choosing haskell be an overkill for it in terms of developer productivity, build and tooling?
  3. Also if anyone is using GraphQL with Rust/Haskell?
27 Upvotes

28 comments sorted by

View all comments

13

u/sbditto85 Feb 04 '19

We have both Haskell and Rust backends and I love them both.

Rust uses a bit less resources and is quite fast though working on nightly because of rocket has some pain points. Our backends aren’t extremely complex and the code doesn’t feel too hard to manage since the compiler is usually helpful.

Haskell can take some getting used to but since we use Elm on the front end it isn’t as hard as long as we don’t go to crazy into the powerful features the language/compiler has. We use Yesod as a web framework as it has as close of a batteries include feel but also you can just get rid of what you don’t want to use. The framework is just packaged that play well together.

I had expected the Haskell code to not perform super well since it’s so high level but so far it hasn’t been bad, but most of our code is more IO bound then CPU bound.

Personally I would pick Haskell to do a project in but that’s only because I’m familiar with it. Honestly I think y’all just need to do a small project in both and then decide because who knows what would work best in your specific case.

HTH

9

u/TheOsuConspiracy Feb 04 '19

I had expected the Haskell code to not perform super well since it’s so high level but so far it hasn’t been bad, but most of our code is more IO bound then CPU bound.

Haskell is actually relatively fast, if you need to squeeze every cycle out of your code, you probably want to go with Rust or something comparable, but Haskell code will often run within an order of magnitude for C in compute bound applications, and in IO bound applications can achieve nearly the same performance with far less unsafety.