One of the topics that I’ve been reading about over and over again is Functional Programming. This topic is mentioned in various areas of computing, be it Distributed Systems, Machine learning or, just recently, application development. Then, at some point I decided to dive into the topic by learning a Functional Programming Language. Back then Haskell appeared to be the best choice.
I came accross the excellent book Learn You a Haskell for Great Good!. Full of excitement I read through the entire book in about 2 days, laboriously completing all the exercises. Reaching the end, I reflected upon what had stuck with me and found that I didn’t even know how to write the most simple program.
Disillusioned, I picked up another book and followed the same approach. Then, another one. Eventually I bought a copy of every Haskell book in existence (there aren’t that many, really). I also tried an online class, which didn’t help me to write a program either.
As a last attempt before giving up, I went to a Haskell meetup. I described my problem and learned that this not only was a common problem, but also was told how to solve it: Pick a small project and try to build it in Haskell.
I picked a seemingly simple project: A guest counter for a website. You will laugh, but it was one of the hardest things I had done in a while. Everything was so unfamiliar, it felt like learning programming again. Nevertheless, an entire (!) weekend later I had done it. I had written my first program in Haskell!
Looking back, I have to say that I wouldn’t do it again this way. Here’s what I’d recommend to you instead:
- Install Haskell on my machine
- Copy+Find an “Hello World” example
- Compile it, Run it, Smile!
- Decide for a small project
- Try to make your project by modifying the “Hello World” example using nothing but documention and articles
- Fail, but note down your question
- Go to a Haskell meetup, find someone that can answer your questions
- Rinse and repeat until you’ve got a first program
Congratulations! You will now have a good working understanding of how to write programs. Only now it’s time to pickup a book on the subject.