As I mentioned, I’ve been learning Haskell. It is definitely the most challenging language I have ever learned. It is also probably the coolest.
Here is a collection of things I found to be useful.
- Yet Another Haskell Tutorial is good for getting started. I kind of fizzled out near the end.
- Good Math, Bad Math has a series of articles that take you from “Why Haskell?” to monads. I thought his explanation of monads was kind of poor if you haven’t already thought about them a bit.
- Speaking of monads. Monads have been extremely challenging for me.
- Part I of all about monads was helpful.
- After reading that and the Haskell Wikibook article on understanding monads, I started to feel more comfortable.
- For quality of exposition, I haven’t found anything better than Philip Wadler’s famous 1992 paper, The Essence of Functional Programming.
- For me, the most enlightening example of monads as a general structure for chaining computations was the Maybe monad. It’s also simple to understand.
- I am currently trying to understand monad transformers, which allow you to use multiple monads together. All About Monads claims to explain them in part III, but he tries to explain them using continuations, another obscure topic people have trouble with! I have not finished digesting/disregarding the following articles.
- A Neighborhood of Infinity has a helpful expository article written as literate Haskell that you can load into your text editor.
- Cale Gibbard, #haskell denizen and all around wizardly Haskell hacker, has an article on how to use monad transformers.
- Some guy who, judging by what appears to be a pro-illegal immigration rally photo as the header of his blog, apparently doesn’t believe America has the right to defend its borders or its sovereignty, has an interesting, more realistic example of using monad transformers which is, as he points out, more concrete.
The flow for reading this non-linear. Jump around, find different sources, look at the material on the Haskell homepage (including Don Stewart’s article on making your own simple IRC bot, for motivation), take a break, come back to it. I have been iterating on monads for about a week and a half now. If you get stuck, the Freenode #haskell channel has been extremely helpful and kind. If you aren’t asking them to do your homework for you, they’re quite willing to help out. They have a Haskell pasting system, hpaste, which is integrated with the chat room, as well as an IRC bot that can evaluate Haskell expressions and do other helpful things. Try it: irc.freenode.net #haskell! It’s full of helpful, smart people. I have never seen it with less than 300 people in it.
From what I can tell, monads and using monads for real stuff are challenging even to experienced, bright people like the Good Math, Bad Math guy (he said he decided to blog about Haskell because he had trouble with combining monads and monad transformers).
This is the first time I have ever really put my mind to something and failed to understand it. I can understand abstract algebra and real analysis, continuation-based web programming, pointers in C, recursion, dynamic typing and higher-order functions, but Haskell has made me its bitch.