January 15, 2018

Haskell

I first learned about Haskell when watching an interview with Larry Wall. They asked him something like what 5 programming languages he thinks people ought to know, and he mentioned Haskell. I had to rewind and listen several times to convince myself he was not saying "Pascal", then a quick search demonstrated there really was a language "Haskell". Then a few minutes of work got it installed on my Fedora linux system, and then the trouble really started.

I had always intended to learn a functional programming language someday. I figured LISP or Scheme would be the thing, but when I discovered Haskell I knew the day had come. So Haskell is the one and only functional language in my repertoire. I am a long time C programmer with a great fondness for Ruby.

It is widely accepted that Haskell is hard. Just making the transition from an imperative language like C or Java to a functional language requires significant changes in thinking. No variables or loops? How can you get anything done? Therein lies the value of the whole experience.

The original version is Haskell 98 (see the Haskell 98 report). Now Haskell 2010 adds some uncontroversial features. The next release is expected to be Haskell 2020. On my fedora system in 2018, I get:
ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.0.2
The claim is that GHC supports all of Haskell 2010.

Resources

Far and away, "learn you a Haskell" is the best resource to learn Haskell. It has certainly served me well. Real World Haskell is available online (and people say that the online version corrects a lot of significant errata in the printed copy). This is actually a very good book, poorly named. In essence it is "the" O'Reilly Haskell book, and a general introduction to the language, very well written by some smart and sensible authors. I was put off by bad reviews written by morons. I was also put off by the title, which led me to think it was a very specific subset of Haskell knowledge pertaining to whatever the authors thought were "real world" applications. I figured that someday when I became an advanced Haskell person, I would find the book useful perhaps, but this was wrong -- it is an ideal book to start with.

There are other interesting online tutorials; here are a few. Actually there are no end of online resources for learning Haskell, the trick is picking the good ones if you are going to invest your time.

I give special kudos to the "fast and hard" tutorial because it begin (like every tutorial should) with a one line "hello world" example.

Haskell network programming

Of course this is IO, so you get involved in the Monad thing with IO.

Project Euler

This site offers a bunch of programming challenges. Some involve interesting mathematics, others are contrived and stupid. But either way, they are fodder for the budding Haskell programmer and I have found solving them in Haskell an interesting way to gain experience with the language.
Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org