I am looking to start an experimental project using a functional language and am trying to decide beween Erlang and Haskell, and both have some points that I really like.

I like Haskell's strong type system and purity. I have a feeling it will make it easier to write really reliable code. And I think that the power of Haskell will make some of what I want to do much easier.

On the minus side I get the feeling that some of the Frameworks for doing web stuff on Haskell such as Yesod are not as advanced as their Erlang counter parts.

I rather like the Erlang approach to threads and to fault tolerance. I have a feeling that the scalability of Erlang could be a major plus.

Which leads to to my question, what has people's experience been in implementing web application backends in both Haskell and Erlang. Are there packages for Haskell to provide some of the lightweight threads and actors that one has in Erlang?

  • 4
    If you don't specify requirements, it's impossible to tell. Just throw a coin or something like that. – Vitor Py Mar 6 '11 at 14:04
  • 1
    I have no proof of this conclusion, but Facebook's use of Erlang indicates to me that it is both powerful and reliable. – Matthew Read Mar 6 '11 at 17:37
  • 1
    @Matthew: Facebook uses Erlang for its chat system, presumably for its massively parallel qualities. – Robert Harvey Mar 7 '11 at 3:33
  • 3
    Yessss, use Lisssssssp. – Mark C Mar 13 '11 at 15:16
  • 8
    In an old Commodore 64 magazine, they had an article on fake languages. The best one was "Lithp", which was exactly like lisp, except that the 's' character was excluded. That forced all 'lithp' developers to substitute a 'th' for the 's'. :) – Berin Loritsch Mar 15 '11 at 12:48

The only question I have is what is your web service doing? If the web service is truly a functional problem, then Haskell will be a better fit.

Erlang isn't necessarily a functional language. It's a procedural language with a very strong execution model for massively parallel systems. It was designed for the telecom industry, and it would definitely make an excellent fit for responding to web service requests.

See this page* for an overview of the differences between procedural and functional programming. (Apologies in advance for the ugly black on cyan page).

If your web service is doing a fair amount of pattern matching and applying rules, then Haskel is your choice. If you just want a scalable infrastructure that isn't too different from the languages you probably already know, choose Erlang.

(* link via Wayback machine. Original file has been removed)

  • It is going to be something that looks a lot like a social network. At this point there is a 90% chance it will be done in haskell. – Zachary K Mar 20 '11 at 11:36
  • 12
    Erlang is a functional language, not a procedural language. It has great support for pattern matching and it's unique pattern matching per bit which is very helpful when doing network services. – Jonas Apr 4 '11 at 23:25
  • @Berin as is always the problem with external links, it's now dead. – thecoshman Mar 23 '14 at 14:58
  • @thecoshman, My appologies... After 3 years I can't even recall the contents of what used to be on the page. – Berin Loritsch Mar 23 '14 at 17:38
  • No worries at all :D ¬_¬ just never let it happen again. (before people freak out, I'm joking) – thecoshman Mar 23 '14 at 19:00

Between the two you mention, definitely Haskell is academic, while Erlang is used in real-life high-scalability projects. So of the two for web services I'd choose Erlang.

But I'd say you have third choice: Scala, a language that is heavily influenced by both Haskell and Erlang. It's used to build top notch web services like Twitter or Foursquare. There is even Lift, a web framework inspired by Rails and Django, although with a bit different, more functional approach. Foursquare is using Lift.

  • 2
    Agree with your answer, except for the very last sentence. Lift is very different from Rails. Rails is modular, Lift is monolithic. Rails is a MVC framework, Lift is not. Rails is object oriented, Lift is more functional. – dbyrne Mar 16 '11 at 14:07
  • @dbyrne: ok, edited – vartec Mar 16 '11 at 16:00
  • 3
    The problem with Scala for web services is that the most popular Java application servers scales really bad compared to servers written in Erlang and Haskell. – Jonas Apr 4 '11 at 23:27
  • 1
    @Jonas: there is for example vert.x vertx.io – vartec Aug 30 '13 at 12:08
  • Lift is no longer the de-facto framework for Scala. It is now Play, which is fully MVC and stateless. I agree with the answer. Scala is a better choice for real-world. Easier to get Scala developers than Erlang and Haskell. – Jus12 Oct 19 '14 at 5:15

Usually i say: "learn things as far as possible from your zone of comfort, it will make you a better programmer even if you never use it in practice".

In this case, that could probably mean Haskell; but Erlang is not only becoming almost socially acceptable; but the main points (light processes, message passing, huge scalability) are coming on many other 'practical' platforms, so the lessons learned have big and immediate applicability on more 'real' work.

my advice: if it's for fun, do Haskell. if it's for training, go Erlang.

  • its for a work type project. I am thinking it will probably be Erlang but I may do haskell. – Zachary K Mar 17 '11 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.