There are lots of books on the programming language, Haskell, which, the folklore say, has a steep learning curve. I am no Haskell expert, having embarked on the journey to learn Haskell myself two years ago and still very much learning. A friend of mine recently asked me for recommendations on Haskell books, which inspired me to write this post. Again, I am no Haskell expert, still very much a journeyman Haskeller.
Usually two books get recommended by almost everyone. Those two books are
There is no question that these two are great books. I have paper copies of both the books and still use them. I think everyone aspiring to learn Haskell should read these books, especially RWH. I am not a big fan of LYH though. I feel that the Haskell Tutorial or YAHT already covers everything in LYH in the same or better way.
There are some other books that I like along with RWH. One of the thing I look, in any programming book that I intend to buy (investing my money) and read (investing my time, because I am serious about learning the material) is that they contain exercises. I feel that testing one’s knowledge of understanding is extremely important and good exercises of varied difficulty (good books indicate the level of difficulty of exercise problems) is very important, as far as I am concerned. So, with that in mind, here are my recommended books on Haskell:
- Introduction to functional programming in Haskell by Richard Bird
Actually I read the previous edition of this book co-authored by Phil Wadler but that book had its examples in Haskell’s pre-cursor language, Miranda. I think just about every programmer should read this wonderful book for the clarity of presentation.
- Programming in Haskell by Graham Hutton
Hutton’s book is probably what one should read (and work through) to get deep into Haskell. It has some great exercises as well. Some people compare this book to K&R C book. For those experienced in other Functional programming languages, this is a great book.
Writing real world programs
I found myself staring at my editor sometimes with just the below lines on it:
The problem is that most of these books teach the purely functional part of Haskell beautifully well. While that is very important and requires a different mindset, especially if one has a prolonged exposure to imperative programming, it can only help to get the room warm by heating up the CPU. One need to interact with the real world to do some stuff in and out. It is extremely easy to do I/O in Haskell. Just start using it without worrying about Monads.
And that brings me to the next topic:
Do not learn monads by analogies. Do not read any Monad tutorials which compares Monads with anything else. Just start using it. Take some time to learn the type signature of Monads and start building programs with them.
If you really want to read a monad tutorial, I highly recommend these two papers.
- The Essence of functional programming - Wadler’s original paper.
- Tackling the awkward squad - Simon Peyton Jones’s paper on Monadic I/O and other side effects.
If you are allowed to read just one blog post on the subject, I would suggest reading Chris Taylor’s post on IO Monad. Be sure to read it after reading Wadler’s and SPJ’s papers.
This is where RWH comes into picture. It has a number of great examples and is written by programmers who have contributed tons of great code to the Haskell community.
Traditional algorithm books describe algorithms in imperative style. Two great books exist in the Haskell world that beautifully describe algorithms.
- Purely functional data structures by Chris Okasaki
- Pearls of functional algorithm design by Richard Bird
Other misc resources
Another great resource is Don Stewart’s StackOverflow answers on Haskell and the
#haskell freenode irc channel. I am not big into irc. I join the channel occasionally, it is one of the most friendly places to hangout with other Haskell programmers.
Happy Haskell Hacking!