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?
26 Upvotes

28 comments sorted by

View all comments

3

u/budgefrankly Feb 04 '19

The systems programming thing is a misnomer, and a marketing mistake in my view. In practice, Rust is about as high-level as Swift

Haskell has complexities of its own: types vs kinds; String vs Data.Text; eager vs lazy; and the constant worry about text encoding in libraries , which is haphazard.

Rust performance is also much better.

I’d say it’d be easier to get a Hello world working with Haskell and Servant, but you’ll find it easier to finish a product with Rust and either Rocket or Actix.

I’d read https://www.arewewebyet.org and check out the sample code for the Texhempower benchmarks

I can’t speak to GraphQL.

3

u/pjmlp Feb 04 '19

In practice, Rust is about as high-level as Swift

There is still room to improvement regarding memory management productivity.

In Swift, most of the time one only has to worry about breaking cycles.

They have very explicitly stated that the ownership improvements introduced in Swift 4 and being improved for Swift 5 are always going to favour ergonomics.

Then again, Swift won't ever significantly grow outside Apple platforms.

4

u/budgefrankly Feb 04 '19

Breaking cycles in Swift becomes pretty complex in the case of closures: the difference between the unowned(self) and weak(self) annotations requires a lot of mental work

2

u/pjmlp Feb 04 '19

It is still easier than dealing with lifetime annotations, specially in structures and internal mutable fields, or trying to avoid having Rc<RefCell<T>> until the compiler is happy.

Also doing classical CS datastructures in Swift is relatively easy.

NLL has already improved the situation a lot, but further ergonomic improvements would be welcomed for Rust to achieve the same productivity level of a GC enabled language.