I've coded in both Erlang and Haskell. Erlang is practical, efficient, and useful. It's got a wonderful niche in the distributed world, and it has some real success stories such as CouchDB and jabber.org. Haskell is elegant and beautiful. It's been successful in various programming language competitions.
I have some experience in both, but I'm thinking it's time to really commit to learning one of them on a professional level. They both have good books out now, and it's probably time I read one of those books cover to cover. My question is which?
Back in 2000, Perl had established a real niche for systems administration, CGI, and text processing. The syntax wasn't exactly beautiful (unless you're into that sort of thing), but it was popular and mature. Python hadn't really become popular, nor did it really have a strong niche (at least as far as I could see). I went with Python because of its elegance, but since then, I've coded both professionally.
I feel like I'm in the same situation again. Erlang is clearly successful and useful, but its syntax is not so wonderful. Haskell is profoundly elegant, and perhaps even higher level, but it doesn't seem as popular, nor does it seem to have success stories as great as Erlang does.
Another interesting thing to note is that Erlang is really good at Erlang-style concurrency. Haskell doesn't have the same zen in this field as Erlang has, but Haskell has successfully tackled a wider variety of approaches to concurrency--at least, that's the feeling I get when I read this page.
Is there anyone out there who enjoys Python's elegance as much as I do who can give me some advice on committing to either Erlang or Haskell? Am I too far ahead of the curve in my hopes to one day code professionally in one or the other? Should I just wait for Reia? Have any mere mortals such as I had success with reading Real World Haskell? Should I take a break from playing with weird languages and do something useful, like write a Facebook app or an Android app?
I have some experience in both, but I'm thinking it's time to really commit to learning one of them on a professional level. They both have good books out now, and it's probably time I read one of those books cover to cover. My question is which?
Back in 2000, Perl had established a real niche for systems administration, CGI, and text processing. The syntax wasn't exactly beautiful (unless you're into that sort of thing), but it was popular and mature. Python hadn't really become popular, nor did it really have a strong niche (at least as far as I could see). I went with Python because of its elegance, but since then, I've coded both professionally.
I feel like I'm in the same situation again. Erlang is clearly successful and useful, but its syntax is not so wonderful. Haskell is profoundly elegant, and perhaps even higher level, but it doesn't seem as popular, nor does it seem to have success stories as great as Erlang does.
Another interesting thing to note is that Erlang is really good at Erlang-style concurrency. Haskell doesn't have the same zen in this field as Erlang has, but Haskell has successfully tackled a wider variety of approaches to concurrency--at least, that's the feeling I get when I read this page.
Is there anyone out there who enjoys Python's elegance as much as I do who can give me some advice on committing to either Erlang or Haskell? Am I too far ahead of the curve in my hopes to one day code professionally in one or the other? Should I just wait for Reia? Have any mere mortals such as I had success with reading Real World Haskell? Should I take a break from playing with weird languages and do something useful, like write a Facebook app or an Android app?
Comments
My recommendation to you is to get a copy of Joe Armstrong's 'Programming Erlang', which is a killer book for anyone interested in getting started quickly, while
'Real World Haskell' is your key to the Haskell world.
For most other tasks though I'd go with Haskell.
Other than that I think you're right, Erlang is a bit of a one-trick pony. It does message passing really well (though IMO most of its benefit is just that it has a little bit of syntactic sugar), while Haskell supports message passing, shared state (with STM or traditional locks), task based parallelism (Control.Parallel.Strategies), and recently nested data parallelism.
So IMO, Haskell will only get more and more attractive because it supports a wide range of solutions to the concurrency/parallelism problem, while other languages usually only support one (or none!).
Haskell seems to be more recent than Erlang, so i would go for it if i had the spare time to learn a new language.
I don't know how to compare the popularity or commercial possibilities of the two languages. I can say that Boston has five companies doing Haskell work.
I can also say that when I lived in Sweden two years ago, there was lots of commercial Erlang work available there.
So, they both seem like professional opportunities to me. I think you should pick one to start, and come back for the other one later.
I'm biased towards Haskell, but that's because I like the #haskell irc community so much!
Language for language sake is neat as well, but then maybe implement a compiler/runtime at that stage? Ask yourself which language would you have the most to learn from the implementation?
To your point - I'd suggest picking one of the Amazon-hosted public data sets, develop an interesting question, then reconsider your choice.
Good luck!
I'm definitely a fan of learning multiple languages, which is why I've played with both Erlang and Haskell. However, I'm still having a hard time committing to one and making it a core skill.
Thanks for the vote of confidence, eGlyph ;)
1. I get bored if I'm not learning something.
2. Python actually can't do everything.
3. There is a certain class of applications where Haskell and Erlang really excel.
That way you can easily implement the language you want. Or at least a quick front-end to whatever you want your language to compile to.
I'd agree with "both", but I'd say start with Erlang. It looks funny and takes some getting used to, but you can do some pretty cool stuff with it.
Erlang has a lot of the functional features that Haskell has (pattern matching, list comprehensions, guards, single assignment), and would actually work as a stepping stone on the way to some of the more crazy ones like lazy evaluation and monads.
Anybody who tells you that Erlang is only good for doing things with concurrency isn't familiar enough with Erlang to be giving you advice about it :)
Hot code swapping and fault-tolerance are even more important features which come in very handy when developing long-running applications.
Erlang is especially well suited for web applications due to this feature. If you're interested in writing those, check out MochiWeb or Erlyweb. I like MochiWeb better, because it's much lower-level and less overhead, but that's just me.
Because Erlang's processes offer addressing and monitoring, they are good fit for modelling a distributed system; it is an open question whether it is easy to make these features available as a library in other languages. However, I can assure that bolting a rich type system and elegant syntax on to Erlang would be painful indeed.
Haskell has broadened my horizons more than any other language; it has opened my eyes to the degree to which computers can verify our programs and how we can use that to speed our work.
Erlang has some quirks, and although it excels at concurrency I wish it was a faster VM
I'm also keeping an eye on Scala, it's getting more use in the Java world and I like the type inference, and it's fast
Clojure is another elegant language, but is very new to the stage -- but worth keeping an eye on
Haskell seems like the type of language you'd use to use Haskell, that's it, the language for the language sake.
It's not a bad idea, but I finished watching the SICP videos. Haskell and Erlang come from the same lineage, but they both have some additional benefits, imho.
Anything that Bob Ippolito does can't be half bad ;)
Ouch! Isn't this blog worth something?
Well, to be fair, I use Python just because it's Python. There's something beautiful and elegant about it. It's not as cheap a hosting solution as PHP, nor is it as popular for Web programming as RoR, nor is it as fast running as even Java, etc. However, it sure is pleasant to code in ;)
That's why I naturally lean toward Haskell, even though Erlang seems more practical.
It's one thing to know a language, but it's another to be an expert. I'm having a heck of a time trying to be an expert of Ruby and Python. I was an expert of PHP, but I gave it up. I've never seriously tried to be an expert of Perl. My Java skills are slowly rusting away--I haven't used them since the 1.3 days.
The problem seems to be that the fast I learn something, the faster I forget something else ;) That's why I was trying to pick something to really focus on next.
That was an awesome read! It confirmed a lot of my early complaints and went a lot further.
Since the success of CouchDB is a huge telling point in favor of Erlang, hearing his sobering comments on some of Erlang's downsides is quite useful.
I may be wrong. That post is from 2007.
How old was Guido when he wrote Python? Wasn't he a little younger then us?
Correct me if I'm wrong: http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=python&lang2=hipe&box=1
Since I mainly focus on programmer productivity, I don't see anything hugely more productive than Python.
http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=ghc&lang2=mlton&box=1
http://eric_rollins.home.mindspring.com/erlangAnt.html
The recent Monad.Reader talks about a "Strict Haskell" trick which makes me happy since I prefer selective laziness over selective strictness. Personality defect on my part?
This, and performance, is one reason why at heart I've been more in the MLTon/SML camp (Not ocaml). However, I find the ML restrictions from its notion of Hindley-Milner typing annoying enough to keep me away from doing serious work there. I keep reading about more expressive changes to the type system (a la Alice) but am wanting something more MLTon than the VM used by Alice.
(Quick story -- I once glued my version of "stackless" python with MLTon and was making calls both directions ... until OOPS the GCs on either side began running. On my list now: investigate region-based memory management or something!)
Has anyone toyed with Clean? That appeals to me but I think GHC plus a bunch of up-and-coming complier tricks will make this language obsolete.
As for erlang. Alas, I want to take time with the language because I think its an awesome platform for distributed computing. But the language itself does not intrigue me enough to engage without some project to propel me onward.
It's strange that Haskell, MLton, and Erlang are all amazing for some reason, but seriously flawed in another way. Haskell doesn't perform as well as MLton. MLton has type flaws that you mention. Erlang has crufty syntax, lacks an ML type system (which may or may not be a flaw depending on your opinion), and can't compile down as low as Haskell can (because of its types).
You suggest that Alice, which I really liked the last time I looked, doesn't have a wonderful compiler like Haskell.
You said, "I prefer selective laziness over selective strictness." Doesn't that match Ocaml? Ocaml is a bit of a turnoff to me too. I spent a lot of time playing with Ocaml a few years ago.
I think I'll look at Alice and Clean again.
I agree with you on Erlang too. It's concurrency model is really neat, but since I know enough Erlang to know some of its warts too, it's hard to commit to it without having a serious project in mind that would benefit from it.
Please keep me updated if you come to any major conclusions.
The code looks like Haskell.
"Clean is the only functional language in the world which offers uniqueness
typing. This type system makes it possible in a pure functional language to
incorporate destructive updates of arbitrary data structures (including
arrays) and to make direct interfaces to the outside imperative world."
"The Clean System is available on many platforms (PC, Mac, SUN) and operating
systems (Windows'95/'98/2000/NT [it's old!], Linux, MacOS, Solaris)."
"The new version 2.0 of the IDE is currently only available on the Wintel
platform."
with rich support for concurrent, distributed, and constraint programming.
Alice ML extends Standard ML with several new features."
It has libraries for GTK, SQL, XML, etc.
It uses a VM with a JIT.
It sounds to me like an Erlang'ish version of ML. I must admit that I like the syntax better than Erlang ;)
Someone should port Haskell to BEAM :D
http://github.com/Nafai77/helloandroid/tree/master
I haven't had the time to do more than that app. I've verified that it runs in the emulator and on an actual physical device, but it is really slow to start up -- like on the order of 10s or something.
I'm not sure if anyone has pursued things beyond this, as I haven't had time to focus on Android development at all.
I'm watching Reia, but it's definitely not ready for production yet. As cool as it is, it's still at the experimental stage, imho.
Travis, thanks for the update.
You heard it folks! If you want the latest news on Clojure, look no further than the comments on my blog ;)
Though, I do plan on learning Erlang later on. To me, I guess practicality doesn't come into play much since my research is on the OOPL side, rather than FPL. I have no need (as of now) to write uncomfortably parallel programs, so I figure it's better to learn Haskell, which seems to be more elegant than other FPLs (obviously IMHO), before diving into the world of concurrency, which is totally exciting...on its own.
http://shootout.alioth.debian.org/debian/
Try starting from this page
http://shootout.alioth.debian.org/
and look at the Ubuntu measurements.
You have mentioned that you bought CTM, so other obvious choice is (not mentioned so far?) Mozart Oz? :) - the language of the book.
I'm a Python hacker. I started reading Real World Haskell in May. Looking into a chat application to use with Django, I bumped into the fact that Facebook's chat application is written in Erlang. So now I'm fretting about Erlang too. What makes it worse is that Programming Erlang looks like a really good book (I think RWH is a very good book deep down, but it could have done with another six months preparation and proof-editing).
It looks like I'll be learning Erlang after reading this discussion.
Best wishes
Ivan
http://falconpl.org/index.ftd?page_id=facts
If you look at http://www.sics.se/~joe/pubs.html for the paper "Use of prolog for developing a new programming language.
J. L. Armstrong, S. R. Virding and M. C. Williams The Practical Application of Prolog" "
You will know a little bit more about where Erlang comes from. A fun paper, wich I might use later :)
(Yes, Joe Armstrong is one of the main architectur of Erlang. And yes, Prolog is a great langugage)
I think it's fair to say that Prolog itself has weird syntax since it's simply an objective fact that languages with C-like syntax are orders of magnitude more popular. Personally, I prefer Python's syntax ;)
However, on the subject of Prolog, I've been coding in Oz lately, and Oz was heavily inspired by Prolog. Neat stuff!
Thanks for the comment, btw.
Python is what it is. I can still *think* in Python faster than in any other language. Perhaps it's lack of experience, but it generally takes me three times as much thinking to get the same amount of work done in Haskell. However, I still think Haskell is amazing.
By the way, have you read: http://jjinux.blogspot.com/2008/05/bipolar-lisp-programmer.html
I actually know Erlang at that level. I just don't know all the OTP stuff, and I'm not at the level where I could call myself an expert.
hxxp://shootout.alioth.debian.org/u64q/performance.php?test=spectralnorm
Erlang's optimization is mostly implementation/hardware based (vm included, etc) - not much of the language itself (Haskell being purely functional), except for the fact that it has been the first to be used on telcos and concurrent systems. Eventually given time, correctness will triumph just as with Python.
Facebook uses Erlang not because they like to, but they need to - and that Erlang/OTP is a proven platform for concurrency. With Moore's law on technology, and Gall's law on correctness - I think evolution favors Haskell.
- Gee Lee