Tuesday, January 15, 2008

Haskell Impressions, Part I

If religion is the opium of the people and marxism the opium of intellectuals, the search for more expressive languages must be the opium of programmers.

In this regard, Haskell is very alluring. The home page used to describe it as:

Haskell is a general purpose, purely functional programming language featuring static typing, higher order functions, polymorphism, type classes, and monadic effects.

Now a more friendly, less ivory towerish tone has been adopted:

Haskell is an advanced purely functional programming language. The product of more than twenty years of cutting edge research, it allows rapid development of robust, concise, correct software.

If part of the Haskell community has decided to market it to a wider audience, it only stands to gain by creating a positive feedback cycle. If it really is a pragmatic tool, programmers in general will benefit too. One initiative to keep an eye on is the Real World Haskell book, which is currently being written and will be available under a Creative Commons licence.

The concepts behind Haskell seem to be very elegant, a powerful abstraction indeed. But how does the language fare in a real world project? Does it make the “easy things easy and the hard things possible”? I have no idea; I only had a brief contact with the language when I read Graham Hutton's Programming in Haskell some months ago.

The book is a very good introduction to functional concepts in general, and very entertaining. But its purpose isn't to teach you day-to-day Haskell; some areas are covered very briefly, others not at all, as you quickly become aware after lurking a bit on haskell-cafe.

If you happen to read the book, don't skip the exercises: it is easy to think you understood something when you really didn't. The two last chapters, “Lazy evaluation” and “Reasoning about programs,” are especially good, worth the price of the book, as they say.

No comments: