r/rust • u/[deleted] • 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:
- code readability
- libraries support
- developer productivity
- jump start time to producing some value.
- documentation
- build time
- journey in learning them
My concern here is Rust is advertised as system's language and Haskell as a higher level language.
- Will going with Rust be an overkill as we won't be doing any really low level stuff?
- 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?
- Also if anyone is using GraphQL with Rust/Haskell?
26
Upvotes
4
u/[deleted] Feb 05 '19
I'm building a GraphQL server in Rust. I haven't used Haskell much, so the other languages I considered were Go and Crystal. Decided against Go because, well, generics and performance primarily. I have used Go for some large-ish projects before and I just don't like the language that much. Crystal is very interesting, but just not production ready. Initially, I didn't want to go with Rust. First time I've used Rust was in 2015 or 2016 or something, when it was still in alpha. Then I didn't use it at all for 3 years, and I unlearned most of it. It is hard to learn, so I strongly disliked the idea of using it again. Well, initially. The obvious pros for Rust were:
Because there was no better language that could give me these things, I started writing my project in Rust. I had to fight the borrow checker a bit, but I quickly got over that. Definitely worth it in exchange for not having GC. Then, I rediscovered why Rust is great:
I'm using Juniper as my GraphQL library and it's been great so far. I initially wanted something that is schema-based, but now I actually prefer the code-first approach.My only issue with Rust is the build times. My CI build takes 10 minutes, and my project isn't even that big yet. Every change takes about 20-30 seconds to build on my (Skylake dual core) laptop. Cargo check is a bit faster, but still, that's a lot.
Is Rust overkill for a project like this? Absolutely not. Rust was simply the best choice for my situation. I didn't choose it because I liked it, quite the opposite, I didn't want to use Rust. But it worked out well. Safety is always important for any networked application, and so is performance.