I love to anticipate trends in the industry, because it can give you that warm fuzzy feeling of betting on the right horse. Particularly, I find satisfaction in seeing a small, welcoming community grow and slowly observe fellow programmers adopt a language, framework or technology that I deeply care about. This is the type of evangelism that I like: bringing to the attention of other programmers innovations that I find, which can make us more productive or help us produce better software. It’s a matter of awareness, there is no intention of pushing anything on anyone.
When a critical mass is reached, you are on top of the wave, ready to help out and already a sufficient expert on the given subject. This was the case for me with the first beta releases of C#, at a time when most developers didn’t have a clue about this new programming platform (.NET). Later in the years, I found myself in a similar situation again when I got into Ruby before Ruby on Rails made it so popular.
It’s not an easy game because there are so many options, a plethora of interesting languages and frameworks. Time is limited and it’s very easy to bet on the wrong horse. Even studying a language with a lot of potential, which is going to be the Next Big Thing™, doesn’t have an immediate payoff. In fact, both C# before its commercial success and Ruby before Rails, weren’t likely to land me many jobs. But eventually they both did.
The reasons behind the desire to spend time and resources on learning something new, shouldn’t only be the prospective of getting a good job. It’s rather the joy of learning new concepts, letting the mind bend and forge to a multitude of paradigms, within different communities and environments. Having the right motivation is key. The monetary gain is more of a byproduct. To quote from The Pragmatic Programmer:
Learn at least one new [programming] language every year. Different languages solve the same problems in different ways. By learning several different approaches, you can help broaden your thinking and avoid getting stuck in a rut.
So a few months ago I asked myself, what’s next now?
The future is functional and concurrent
Before I decided what language was worth studying in depth next and even before attempting to suggest the same to my readers here, it’s important to clarify what are the characteristics that I considered the most in picking my choice. I mentioned a different paradigm as a first requirement. As the Turing Award laureate Alan Perlis put it:
A language that doesn’t affect the way you think about programming, is not worth knowing
For me, this pretty much excluded languages which were too similar to the ones that I had already well endorsed (e.g. Perl or Smalltalk).
We are also at a turning point in the development sector, because CPU producers are focusing on the production of multiple cores/processors rather than trying to merely increase the speed of a single CPU. This, more than the raw speed, introduces a radical change of requirements for programmers. If we have 2,4 or 16 cores, we better start thinking about how to develop applications that take full advantage of them. Concurrent and parallel programming can be quite tedious and error prone when adopting languages that are not designed for these requirements. Ruby’s current lack of native threads is then particularly unfortunate in these scenarios, as it implies that Ruby will take advantage of a single processor only.
My third requirement, which further specifies the first one, was that the programming language needed to be a functional one. The ever growing software complexity requires the power of high level abstractions and the functional paradigm which helps us adopt a more declarative programming style where the side effects are marginalized.
There are two programming languages I mentioned a few months ago which meet these requirements quite well: Haskell and Erlang. About a year ago I started to show an interest towards both of these, mostly favoring Haskell, despite Erlang’s excellence in concurrent scenarios. In 2006 however I mostly put aside my interest for them, trying to focus on improving my existing skill-set. Having covered the basics of Haskell and Erlang quite some time ago, it was about time for me to make a decision and pick my new challenge.
Many folks blogged about the Pragmatic Programmers announcement about a book on Erlang, written by the language’s author Joe Armstrong. This is excellent news because there is so much need for an authoritative and accessible book on the subject. So much so, that I informally proposed to the Haskell community to get in touch with Dave Thomas if interested in producing a book of this caliber for Haskell.
Erlang is very tempting, and I’d buy that book just to promote the writing of excellent books on less common subjects. We don’t need the Nth book on Java, we desperately need great books on not so popular and emerging topics like Haskell, Erlang, Clean, OCaml, D, etc…
The Pragmatic Programmers have been very influential in the Open Source community and they have surely contributed to the success of Ruby. There is no doubt that they will be crucial for Erlang too. Their Erlang book won’t be the only reason why I think Erlang is going to be more popular than Haskell in the long run though. Despite this, my choice is Haskell, and I’ve been concentrating my efforts on gaining in depth knowledge about it.
Haskell is an extremely easy to learn programming language… 🙂 Sorry, I couldn’t say that with a straight face. Let me rephrase it: Haskell is an easy to learn language if you’re a mathematician. But it’s definitely not the easiest one for the average programmer. This may cost Haskell a lot in terms of its popularity. Erlang is easier to learn if you come from an object oriented/imperative background because, unlike Haskell, it is not purely functional. However I absolutely love the radical paradigm change in Haskell, the Monads, the referential transparency and the lack of side effects. Plus I think it’s the right tool for developing solid and reliable software systems for the future. It’s an extremely advanced programming language, that makes you reconsider the way you think about programming. It is quite possibly one of the few programming languages which is able to expose the limits of, gasp… Ruby. It can be very complex for many, and I’d love to contribute towards making Haskell easier to learn, but let’s not forget that it is not expected to be very easy or become as popular as Ruby. It is instead expected to be powerful and able to produce less bug prone programs. To quote E. W. Dijkstra:
The proper technique is clearly to postpone the concerns for general acceptance until you have reached a result of such a quality that it deserves acceptance. It is the significance of your message that should justify the care that you give to its presentation, it may be its “unusualness” that makes extra care necessary. And, secondly, what is “general”? Has Albert Einstein failed because the Theory of Relativity is too difficult for the average highschool student?
It is very likely that other languages will keep integrating features, particularly from Haskell for the functional side and from Erlang for the concurrent model, but I’ve chosen to give a shot to the “real thing”. I love the technological advantages that Haskell can provide me with and it has been my biggest personal interest for some time now. It’s a very beautiful language which I recommend wholeheartedly to the most adventurous Ruby and Python programmers.
How to get started with Haskell
If you are interested in exploring Haskell, the official wiki has a lot of information. In order to take the first steps, I do suggest the following though:
- Grab the Glasgow Haskell Compiler which is the most popular Haskell compiler. It ships with GHCi which is an interactive console similar to irb for Ruby and Idle for Python;
- If you are mathematically inclined, read A gentle introduction to Haskell. It’s a short and sweet introduction, but should you find it as gentle as an angry Rottweiler, you may want to start with the Haskell Wikibook instead;
- As a reference, use Hoogle – The Haskell API Search Engine ;
- Join the Haskell-Cafe newsletter and the irc.freenode.net channel #haskell;
- If you have time, watch the English Video Lectures from a German University (from 2005-SS-FP.V01 to 2005-SS-FP.V26). They introduce Haskell step by step, so you may find them helpful albeit a bit slow.
And lastly, you can take this article as an announcement about my future entries on Haskell in this blog.
Get more stuff like this
Subscribe to my mailing list to receive similar updates about programming.
Thank you for subscribing. Please check your email to confirm your subscription.
Something went wrong.
It would be really interesting to see a semantic comparison of Haskell vs. Ruby/Python that goes beyond the algorithmic trivias of quicksort implementations.
Something like solving a difficult problem and an ordinary problem (such as database web frontends).
I was about to decide which of these two functional languages pick as the next learning step. Now that I’ve read your article I’ll definitely go fo Haskell!
Thanks! π
I agree with Federico; I was wondering which language to learn this year, and you helped me take the final choice!
I read always your blog and I didn’t see this one coming. Now I feel the urge to check out Haskell right away. You’re inspiring as always.
Programming in Haskell by Graham Hutton is a good introductory new book.
Does anyone know of Haskell being used in production? Are those who have been swayed to try Haskell doing so because it is the bigger challenge? I’m going with Erlang because of my interest in concurrency, its use in production, and the Pragmatic book (is it being called the Crosswalk book yet?).
Hi Brian,
“this wiki page”:http://www.haskell.org/haskellwiki/Haskell_in_industry has some details about companies employing Haskell for commercial use. π
@Lorenzo: Yeah! Maybe you could write a fibonacci function!! Or FizzBuzz!!! π
If you want a taste of what “real” Haskell code looks like, check out the source of Darcs, Pugs, or GHC.
I couldn’t agree with you more about concurrency. We’re going to have to deeply reconsider the way we think about mutable state.
Erlang is absolutely fascinating, and the new Pragmatic Press book is great. I can’t wait until the final chapters are written.
But like you, I’ve been focusing on Haskell lately. I’ve been impressed at how many neat ideas there are in Haskell, and how closely everything is tied to math.
Here are two cool things I learned recently:
* Map fusion: algebraic optimization
* Bayesian inference using monads
Now if only I could figure out how to build a reasonable monad DSL in Ruby!
Hi Antonio, sounds exciting. I’m looking forward to your post. π
“Itβs not an easy game because there are so many options, a plethora of interesting languages and frameworks. Time is limited and itβs very easy to bet on the wrong horse.”
I disagree. There are only a handful of language that define all the current paradigms. If you know them, then you know ALL computer languages, given a couple hours to pick up their syntax.
Haskell, Scheme, C, Smalltalk (or Eiffel, or Java. OO is so overrepresented you have lots of good choices.), Prolog, Erlang, and Forth. Learn those and you will have fad-proofed yourself. All the fads for at least the next 10-20 years will just be combinations of these basic language paradigms… unless something truly revolutionary happens, but we will recognize that easily if it happens.
I’m a Python guy, and I chose Haskell as my LotY as well. Thanks for the pointer to the lectures — though I wish there were audio-only versions!
While I’ll admit up front that I have a background in pure mathematics, I’ll agree that Haskell isn’t the easiest programming language for existing programmers to learn.
However, I don’t think the difficulty really stems from the need to understand mathematics. Mathematics provides some cool inspirational effects when combined with Haskell, and conversely, Haskell might inspire you to learn some mathematics, but aside from that, it isn’t really the key thing.
The real reason why it’s hard for programmers to learn Haskell is that it takes a different approach to computation, and requires a bit of “unlearning” of the languages you already know.
Unless you already know something like ML, it’s a bit like learning to program for the first time again. (Even starting from a strict functional language though, there’s still some brain-contortion needed.)
For those completely new to programming, I don’t think it’s really conceptually any harder than Python or Ruby. In fact, some things turn out to be more natural for non-programmers.
My friend, who was relatively new to programming, though he’d done a little Java and C++ before (just a couple of courses, and he hadn’t enjoyed it), gave me the example that when he goes to wash a bunch of dishes, he doesn’t go and number the dishes and then iterate over them, incrementing a counter, like one might do in a traditional imperative language. The thought process, he said, is a lot more like ‘map wash dishes’ — you just wash them all. He found the language fairly natural overall.
I’ve also been tangentially involved in a course which was teaching Haskell and basic mathematics (simple number theory and logic) to brighter 11 year old kids, and that went quite well. They even found the basics of monads not too hard to understand.
So I think it’s not so much that Haskell itself is hard, just that traditional perspectives can get in the way for a time when you’re initially learning it. (Don’t worry though, later on, that knowledge comes back as useful, it just needs time to reform itself into a new shape.)
I’d like to add another step to your list of things to do while learning Haskell. Grab an IRC client and come to #haskell on irc.freenode.org. Don’t be afraid to ask lots of questions there. π It will probably save you lots of time looking for the answers on the web, and it’s more interactive. Quick questions are even commonly answered in stereo, because everyone’s willing to help out. π
I’ve been coding some Haskell at my university for the third year now, and still fail to see how this can become useful. For little algorithms or little data structure exams its nice, but the large Haskell programs become very cryptic and cost maybe more lines of code than a similar ruby program.
Example:
http://happs.org/HAppS/src/HAppS/DBMS/Example.hs
What Haskell really needs is some kind of Ruby on rails or django style framework to even have a chance against ruby and python.
You don’t have to agree and I’m willing to change my mind of any of you can provide me with real life useful production ready examples which beats the living **** out of any ruby (on rails) program ever made. In fact I would be even happy if I have any use of all those courses which taught me Haskell on school.
Note: my post is from a web developer point of view
…read A gentle introduction to Haskell. Itβs a short and sweet introduction, but should you find it as gentle as an angry Rottweiler…
This cracked me up π
It does feel like there’s a critical mass of interest starting to accumulate. There’s nothing like working problems to learn the language; the Ruby Quiz is one nice place to get problems not necessarily contrived for solution with a functional language.
As a learning tool, the Zvon reference is also useful.
Hi Paul,
there is a Haskell port called “Haskell Quiz”:http://www.haskell.org/haskellwiki/Haskell_Quiz.
Tom, that’s a not terribly great example of Haskell code written with HAppS, which is generally a fairly nice clean library for web applications. That code is from 2005 though, which means it’s quite old relative to HAppS itself, which has gone through a number of revisions since then. Also, that code is not really a web application, but a collection of small snippet examples of queries against a database, and some DB marshalling code that looks like it could be refactored a bit.
For a nicer and more modern and complete example, check out http://hpaste.org/ (check the source code link at the bottom). It’s a simple IRC paste site for #haskell. It took about a day to develop, and perhaps another day or so to add the IRC bot. The code is fairly readable. The HTML bits are probably the strangest looking bits at first, but are not too hard to comprehend, and guarantee strict XHTML compliance.
The paste application itself, including the XHTML bits that make up a large portion of the code, comes to around 600 lines. The IRC bot which announces pastes and annotations is about 200.
There are also rather nice libraries for processing XML, such as HXT. I spent a few minutes learning HXT and whipping up a simple RSS -> HTML aggregator example, which you can see here:
http://cale.yi.org/index.php/HRSS
I could probably clean that code up further now that I know the library better, but it’s fairly simple already.
There’s also some work on a pretty neat extensible web application/content management system called Hope, which you can check out at
http://hope.bringert.net/
Most of the web stuff in Haskell is fairly new, since only pretty recently has Haskell had many people interested in that direction of development. Manipulating HTML and XML is an inherently messy problem in a way which makes most Haskell programmers cringe (we want static typing guarantees, and won’t put up with direct string manipulation), but there are now decent solutions like HXT and HAppS which are opening up the floor for more complex web applications.
I second the suggestion for #haskell. It’s a very kind and helpful place for questions both little and big.
Once I had my feet under me a bit I also found hoogle to be helpful, especially when trying to remember some of the functions from the standard prelude. For example, what’s the name of that function that takes an integer n and something and returns a list of that thing n times? Search for: int -> a -> [a]. The sorting of the results isn’t google quality, but it’s generally on the first page (in this case, it’s replicate). It’s nice how self-documenting the standard functions are, given their names and types.
As far as the Erlang vs. Haskell choice goes, I’d say that Haskell will change the way you think about programming more dramatically. I’m learning Erlang now because I have a project that seems well suited for it.
(Side note: the pragmatic programmer’s book on Erlang is fantastic so far)
Haskell is probably not a good language for web applications and other boring but valuable business software.
Anyway, most Ruby users don’t care about something if it isn’t a new Rails plugin or some crap. Every single program in the world must pertain to databases and HTTP.
Antonio: You’ll find a couple of my solutions among those on the Haskell Quiz. It will be a nice resource as more people fill in solutions to the problems, and comparing to the solutions in Ruby provides a reality check on expressiveness.
Interesting article. I completely share your opinion for learning a functional and/or concurrent language. My current choice is on Erlang nevertheless (after C++, Java, Ruby). The upcoming Erlang book from PragProg is one of the reason of this choice.
I’m surprised that this has become a 2 horse race with Erlang and Haskell, why no O’Caml? I have jumped on the Erlang bandwagon personally (due mainly to concurrency interests) but my runner up is definately O’Caml over Haskell.
David, O’Caml is mentioned in this post, but I think the author is looking for a purely functional language and he favors Haskell over Erlang because of this.
My brother, Chris, has been a Haskellite for awhile (Check out his reg ex contributions). We’ve had an ongoing dialogue about ruby vs. haskell, and lately my only good excuse for not learning it better has been the weight of other projects.
Haskell is perhaps not entirely main stream, but it is neither a small nor complacent group – and the performance numbers get better every day. I agree this may well be the future (for some particular class of programming problems), but I will be curious to see how far out that future is.
I also somewhat wonder why a LISP revival is less possible than a Haskell ground swell? (((Both look more like math than programming))) are functional, and favorites of language purists…
My other tid bit is to check out lambda the ultimate if you find this sort of talk entertaining, and are looking for programming language news a bit ahead of the curve – amongst other amusing content.
Interesting — I’m a mathematician, spent a number of years on my own studying the lambda calculus and combinatory logic, think pure functional languages are the greatest invention since sliced bread, etc. — and my bet is on Erlang!
Here’s my reasoning:
1. Last year, there was a functional languages conference here in Portland. All the major languages were represented. I didn’t go to the whole conference, but I did go to two of the language-specific sessions. I ended up going to the Erlang session and the Scheme session. I’m not sure why I didn’t go to the Haskell one, but I can tell you that something like a third of the attendees of the Erlang session were from Amazon.com! Is there similar industrial interest in Haskell?
2. Lambda calculus, Currying, combinatory logic, etc. are old theories. They saw an explosion of interest in the 1970s — that’s when I learned them, anyhow — but never gained an industrial foothold. Lots of great stuff got *prototyped* in Common Lisp, but not a heck of a lot of that remains in use. So, Haskell makes a great language of the year if it’s your *first* functional programming language. It will make you a better programmer in other languages. But if you already have a good Lisp or Scheme background, I’d pass on Haskell.
3. I’m a performance fanatic. I study things like Generalized Stochastic Petri Nets, queuing theory, Markov and Semi-Markov processes, matrix-analytic methods, and I do performance engineering for a living. A language named after one of our pioneers, Agner Krupp Erlang, is going to get my attention.
So — I’ll stick with Erlang for this year, as well as continuing with last year’s language, Ruby, and my language of choice for the previous five years, R.
One other note: if you *really* want a language that stretches your mind, try Forth. The best way to think of Forth is that it’s Scheme turned inside out with a built-in assembler, compiler, interpreter and editor.
Haskell was my first programming language when I joined University and I just loved it! Maybe it was because I also liked Math, but I found Haskell easy to learn and a great way to exercise our brain and make us creative.
The industrial credentials of Erlang… especially with regard to concurrency… are *really* hard to ignore. Haskell may or may not garner industrial acceptance; Erlang already has industrial acceptance.
And Erlang looks like Prolog… Prolog is cute and cuddly =)
Excellent!
It’s an enlightening article…the next “thing” to learn during this year.
Thanks a lot!
Yeah and besides, the guys who made C & C++ are rotting away. They’ll be dead soon so the idea of functional programming kicking the door down and reshaping everything comes at a great time.
I studied Haskell about 10 years ago and have always considered it to be the most elegant language I’ve ever come across (math geek, clearly).
Recently I’ve been spending all my time playing with Erlang. The concurrency and fault tolerance kick the hell out of anything else out there and the work Yariv has been doing on Erlyweb (http://erlyweb.org) and Erlydb make it a dream platform for web developers.
No one mentioned Simon Peyton Jones’ article on Software Transactional Memory called Beautiful Concurrency:
http://research.microsoft.com/~simonpj/papers/stm/index.htm#beautiful
Here’s a response and code in Erlang:
http://www.cs.otago.ac.nz/staffpriv/ok/santa/index.htm
STP is really interesting – those guys are doing some great work that I think holds great promise for how we deal with shared information in the future.
STM, sorry.
I have been learning Haskell for a month now an was surprised at how much I could do in such a short amount of time. I am interested in erlang as well for the concurrency-ness of the language. However, the shear pleasantness of using Haskell struck me as I have never been struck before.
I’m going to have a bit of a play with haskell again soon as it’s always good to understand the strengths and weaknesses of these different systems.
I really love the concurrency aspects of erlang. processes and message passing solve lots of problems when it comes to shared memory.
I think that the Io language ( http://www.iolanguage.com ) offers a good deal of what is attractive in Smalltalk ( which should appeal to a Ruby-ist ) and most of what is offered by Haskell/Clean for concurrency.
It can be interesting to compare evolving Cecil ( -> Diesel ? ) to Strongtalk with regard to exploratory programs evolving to safe programs. I recall Prolog purists railing against Borland’s Turbo Prolog (now PDC Visual Prolog) for its type-checking, but then you see that the Oz/Mozart folks took some inspiratiion there. Of course I have the same gut reaction to LiveScript becoming typed ECMAscrt ( or who cares – we have a very cool distributed Self available ( dSelf at http://www.ag-nbi.de/research/dself/ ). Cheers, Robert Shiplett
It appears as though the submission date/time in your rss feed is a bit wonky. This article has been routinely appearing at the top of http://planet.haskell.org/ for at lease a couple of weeks now.
(not that i dislike the article. i just don’t need to read it daily. π
I tried to learn Haskell, it seemed very hard to learn. But I am not a mathematician.
I’m definitely trying out Haskell now, it has always interested me!
Have you heard of Mozart/OZ very nice programing language. and Alice a dilect of ml with oz style concurancy
I have been learning Haskell in my spare-time for a couple of months so far and have been reading “Yet another Haskell Tutorial” available here: http://www.cs.utah.edu/~hal/docs/daume02yaht.pdf
I think it’s a very good book. It’s worth reading.
I think I really like this programming language and the whole functional programming approach.