News for hackers. Stuff that matters.

Poll: Haskell or Go?

if you were to pick up a single new language to learn and use in real world server side applications. Which one would you pick, Haskell or Google's go?
( 33 comments | 22 points | on HN )

Poll

Haskell 136 votes
Go 100 votes
Other 54 votes
Re:Poll: Haskell or Go? by unoti on Saturday December 11, 2010 @02:33PM (#1995479)
Would ya'll be willing to give feedback on a similar thing I'm struggling with?

I've been contemplating this same question a lot of the past few months. As many readers point out, the type of application you're writing weighs heavily on what language and tools you should use.

The application I'm writing is a persistent world server for a game. The world server will need to be composed of multiple servers cooperating. Here are the languages I've been looking at:

- Erlang. I really wanted to use this, but just felt so constricted not even being able to do a loop. I realized later after much work that this feeling is simply because I hadn't (and still haven't, sufficiently) manned up and become comfortable with functional programming. The OTP framework is beyond compare for quickly building reliable distributed systems. Actors are a perfect fit for being part of the puzle for this target application of writing a distributed game world.

- Scala. Like erlang, plus the ability to use awesome java things such as Netty and Zookeeper. Lacks OTP, so a lot of the things Erlang has built in like distributed actors are missing. The Akka project seems to be targeted at bringing the missing things into Scala. For a while I felt that I had finally found the perfect platform for doing my server: Scala + Akka. But then I started finding that I was going to have to roll a lot of my own things (e.g. http://stackoverflow.com/questions/3692680/scala-akka-how-to...). Plus I started feeling like the Scala language is kind of more complex than it needs to be. Perhaps I wouldn't feel that way after working with it for a few months every single day.

- Clojure. The main appeal to me here is that I've long felt that I'd never be a real man until I could shoot lisp from my fingertips while laughing at all mere mortals. I've started studying lisp, including working my way through the MIT opencourseware. This is an ongoing side project. But Lately I've been thinking about just writing the software instead of trying to prove myself to the faceless elite whom I'll never meet. The most unique awesome power of Clojure to me for this application is STM, which I can get with Scala + Akka in a format that's less alien to me.

- Go. The syntax is easy. It's trimmed down and simple. Concurrency is trivial to do. There's a lot more rolling-your-own for this app, because it doesn't have built in OTP-like things for restarting failed processes, like Eralng and Scala+Akka do. What Go lacks in requiring me to roll my own, it makes up for by being lean and mean. Biggest downside to me about Go is that it seems relatively complicated to use external libraries I may want to use, such as Zookeeper. I also really grew to love Netty while using Scala, for handling tons of socket connections all at once. But perhaps I won't even need that when using Go, I'm not sure yet. I also think I'll be able to do a lot more per-megabyte of RAM using Go than I can with Scala. I have not tested that hypothesis, but plan to.

Various Python things. I considered using Stackless, but this seems like a dead end today compared to where it was a few years ago. I also looked at Twisted and worked through a book on it. I decided that if I want to do a lot of Arcane backwards tickery, I may as well use Erlang or Scala. Twisted, to me is the worst of all worlds: having to do strange arcane things, plus having it be in Python when it's done instead of compiled or JIT like Go or Scala. (Erlang gets a special pass in this context because it's so proven.)

Node.Js - I never really seriously considered this, because I really want to use an actor-style approach. (Maybe I missed the boat here, and should try this, spawning one node.js per cpu core per machine?)

Over the last year, I keep moving between Erlang, Scala, and Go, trying to figure out which I really want to use. My current plan is to write a working, multi-node proof of concept in all 3, and see which codebase I like best, then move forward.

Do you have any comments or thoughts I should consider along the way? Am I seriously missing out by so casually dismissing Node.JS for this application?

Re:Poll: Haskell or Go? by enneff on Sunday December 12, 2010 @06:16PM (#1998431)
Re:Poll: Haskell or Go? by unoti on Sunday December 12, 2010 @08:23PM (#1998794)
Thank you! This is very relevant to my interests.
Re:Poll: Haskell or Go? by wwortiz on Saturday December 11, 2010 @01:08PM (#1995303)
Erlang or nodejs probably would be some other good options, you don't really hear about go being used much in this context.
Re:Poll: Haskell or Go? by Locke1689 on Saturday December 11, 2010 @01:22PM (#1995335)
What kind of "server side" application? As a systems developer many of my applications would be more suited to Go. The biggest problem with Haskell's lazy evaluation system in real world analyses is that performance is unpredictable. While I would strongly consider using Haskell for an academic publication (e.g., my master's thesis), I would be more cautious about using it in a systems capacity. Then again, my assumption for most of HN is that we're not talking about systems development, it's just that Go is directly targeted at systems development.
Re:Poll: Haskell or Go? by iskander on Saturday December 11, 2010 @01:44PM (#1995373)
Haskell with a cleaned up library and eager evaluation would be a dream. Alternatively, adding type classes to OCaml (and removing the object system) would yield a similarly awesome language.
Re:Poll: Haskell or Go? by Locke1689 on Saturday December 11, 2010 @02:23PM (#1995461)
FYI, Haskell was originally created as an extension of Miranda, basically a testbed for lazy functional languages. Removing lazy evaluation seems almost like killing the language.
Re:Poll: Haskell or Go? by distortion on Saturday December 11, 2010 @02:29PM (#1995474)
I'm working on a language along those lines, called Aeon. I guess I should save any plugging until I actually release something!
Re:Poll: Haskell or Go? by urza on Saturday December 11, 2010 @01:51PM (#1995386)
Haskel is beautiful language, but I voted Go because side effects in Haskel are pain and if you want language to the server I suppose it is because of doing side effects (like working with db or files, changing memory, serving webpages etc).

Plus Go has easy conurrency via message passing, which is nice to have these days.

Re:Poll: Haskell or Go? by pyrhho on Saturday December 11, 2010 @01:56PM (#1995406)
> Plus Go has easy concurrency via message passing, which is nice to have these days.

Indeed. I voted Go because learning it made writing concurrent software FUN! (As it should be)

Re:Poll: Haskell or Go? by bickfordb on Saturday December 11, 2010 @02:22PM (#1995459)
Haskell has easy message passing as well. You can plop "forkIO" in front of any IO operation to make it concurrent
Re:Poll: Haskell or Go? by uriel on Sunday December 12, 2010 @11:18AM (#1997266)
Not the same thing really.
Re:Poll: Haskell or Go? by dillon on Saturday December 11, 2010 @12:50PM (#1995268)
I personally think that these two languages were built to do different things. I think it depends on the job that you have and what you need the language to accomplish in order to say which language is better to learn. I chose Go, because I'm a Web Developer and if I ever needed to do low level stuff I would use Go or Java.
Re:Poll: Haskell or Go? by jfb on Saturday December 11, 2010 @01:34PM (#1995349)
I would try and expand my Haskell knowledge; Go is too similar to languages I already know. I would take this as an opportunity to learn. Erlang would be the other choice.
Re:Poll: Haskell or Go? by jfb on Saturday December 11, 2010 @03:40PM (#1995615)
This is not to say that Go doesn't have a lot to teach me; it's just that I would be more interested in the semantics of building large systems in a language/environment that's utterly alien from those I've done before.
Re:Poll: Haskell or Go? by troutwine on Saturday December 11, 2010 @02:28PM (#1995473)
Erlang. Sometimes I curse it for being a high-level, low-level language yet I always come back to it in times of need. (Or for play, really.)
Re:Poll: Haskell or Go? by exch on Sunday December 12, 2010 @07:37AM (#1996977)
I've been using Go for various things for quite a while now. I do love the language. If I would use it for any serious large scale project? Perhaps not just yet. There are still some wrinkles that need ironing out. Most notably: Go's GC.

These 'wrinkles' are not fundamental problems with the language though, and most are on the slate for fixing, so it's just a matter of time for Go to be ready for anything. Development pace is still quite furious and improvements are coming out every week.

In the meantime, I thoroughly enjoy using it for smaller tools and assorted bits and bobs. It's a very pleasant language to work with.

Re:Poll: Haskell or Go? by jules on Saturday December 11, 2010 @02:00PM (#1995412)
This is a rather limited poll, but if the choice is between Haskell and Go I'd pick Haskell for a web application, and Go for small things that need to be fast (like receiving and sending messages in a chat application). Go is too low level and generally not a very well designed language. It's a nice improvement over C, but it keeps far too much from C for my tastes.
Re:Poll: Haskell or Go? by dadkins on Saturday December 11, 2010 @02:00PM (#1995413)
For me, Go has replaced C++ and Java for systems work. All of my projects at work for the past 6 months have been done in Go. I don't think we'll be going back.

But, really, good systems are based on well-defined protocols, which makes the language choice moot. (If you're passing Java or C++ objects over the wire, shame on you!)

Re:Poll: Haskell or Go? by cbo on Saturday December 11, 2010 @02:07PM (#1995422)
Could you possibly share a little bit more about the kind of work you do and why Go has become the clear winner over C++/Java?

I, for one, would really love to learn more about Go.

Re:Poll: Haskell or Go? by dadkins on Saturday December 11, 2010 @04:33PM (#1995710)
I work on large distributed systems. I've found that Go is a much cleaner and simpler language than C++ or Java, by far. You get the compiled speed and control over memory layout of C++ with the garbage collection of Java. The concurrency model in Go is a natural fit for programs that make heavy use of disks and networks; it neatly sidesteps the threads vs events debate (and both of those can lead to some nasty programs). But most of all, the language is pleasant to use and the compilers are really fast (ever tried to compile a million line c++ or java source tree?).
Re:Poll: Haskell or Go? by raz0r on Sunday December 12, 2010 @06:13AM (#1996917)
You got me a lot more curious about Go than I already was.
Re:Poll: Haskell or Go? by ampledata on Saturday December 11, 2010 @01:10PM (#1995306)
Really though it's less about which language you choose and more about which programming paradigms you've studied: functional & oop for example. Personally I'd find learning Haskell entertaining, but not very applicable to my day-to-day enterprise software gig.
Re:Poll: Haskell or Go? by w1ntermute on Saturday December 11, 2010 @01:23PM (#1995339)
> Personally I'd find learning Haskell entertaining, but not very applicable to my day-to-day enterprise software gig.

I'm interested in Haskell - what exactly is lacking about it? Is its design fundamentally flawed, or does it just lack a community and all the things that come with that (libraries, support websites, etc.)?

Re:Poll: Haskell or Go? by kumarshantanu on Saturday December 11, 2010 @01:12PM (#1995313)
Mozilla Rust is interesting.
Re:Poll: Haskell or Go? by pjmlp on Sunday December 12, 2010 @09:00AM (#1997078)
I would pick up Haskell. It is a more mature language, there are already quite a few companies that use it in production code.

Even thought it is a mainly a functional programming language it allows the programmer to express in a more natural way lots of programming algorithms.

It allows a more easy way to explore multiprocessor programming by contrast with Go's go routines, because of the functional semantics.

Re:Poll: Haskell or Go? by dstein on Saturday December 11, 2010 @01:39PM (#1995360)
For the "real world" applications I think you should at least consider Scala and Clojure also. Because they're both JVM based you can rely on the Java infrastructure that's been built up over the past 15 years.

If you're doing web development, or network applications, NodeJS is also notable, there's a reason it's getting a lot of attention lately, the fun-factor is just off the charts.

Re:Poll: Haskell or Go? by vegai on Saturday December 11, 2010 @02:01PM (#1995415)
Depends a lot on the need.

Haskell has lots of fundamental weaknesses when it comes to long-running real world programs, laziness being the most obvious one.

Re:Poll: Haskell or Go? by chc on Saturday December 11, 2010 @05:23PM (#1995789)
Unless you have a space leak, how is laziness a weakness there?
Re:Poll: Haskell or Go? by vegai on Monday December 13, 2010 @05:43AM (#2000049)
I've had issues with lazy IO that caused awkward behaviour. Identifying the root cause was not trivial, and altogether, laziness gave me no benefit and caused me lots of harm. This is the most important point here: when laziness is useful very rarely but causes non-trivial trouble often, why on earth have it on by default?

I'm sorry that I cannot remember the specifics of my problems, this project was done years ago.

Re:Poll: Haskell or Go? by cobb_88 on Saturday December 11, 2010 @01:41PM (#1995366)
Definitely Haskell
Re:Poll: Haskell or Go? by ampledata on Saturday December 11, 2010 @01:11PM (#1995308)
Re:Poll: Haskell or Go? by anacrolix on Sunday December 12, 2010 @09:25AM (#1997124)
Haskell is too academic. Go suffers from dreadful interoperability with other languages, even C.