Getting started with Haskell (and functional programming)

So you want to learn Haskell, good for you! It’s not going to be easy and it would be helpful to have some programming experience beforehand, but with a little perseverance and the right tools I’m sure you will pick it up faster than you thought possible. And equally important: Haskell is a lot of fun!

But, make sure you know why you want to learn Haskell! It will make it so much easier to get through the hard parts if you know what awaits you at the end of the tunnel.

Step 0: Installation Time

Before you can start coding, you need to install a bunch of things and with Haskell that can be a pain. Luckily, Bob Ippolito wrote an excellent blog post explaining how to set everything up the right way.

Step 1: Getting familiar with functional programming & Haskell

By far the most accessible, yet very comprehensive, beginner’s guide is the Learn You a Haskell For Great Good book, which is freely available online.

While you are learning the basics of Haskell, test you understanding by doing some (or all) of the 99 Haskell problems.

Once you get up and running, it’s time to write something a bit more complicated. Real World Haskell will get you there. It covers a lot of the concepts already covered in ‘Learn You a Haskell’, but is a much more hands on tutorial.

Finally, you could also do the full MIT course on Haskell. It’s pretty fast and does not always go into the specifics, so I would only recommend this for more experienced programmers, or those who’ve already gained some basic understanding of Haskell (with help of the abovementioned resources).

Step 2a: Build something

So you now understand basic Haskell and you wrote a few scripts with help of the tutorials above. Great, you’re ready to remove the training wheels and write something yourself. Haskell is great for writing algorithms, so you could start by implementing one. If you’re lacking inspiration, here are some good ones: https://projecteuler.net/

Or, write yourself a Scheme in 48 hours. Probably the most hands on tutorial out there.

Another thing Haskell is great for: parsing stuff! If you’d like to write a parser, you should start here.

Although Haskell isn’t exactly the go-to language for web development, there are in fact two good frameworks that allow you to build sites in Haskell: Snap and Yesod. I would personally recommend Snap, but it’s basically a matter of taste. Both come with (short) tutorials!

Step 2b: Become part of the Haskell community

A great way to learn anything is to get tips from the experts. The cool thing about Haskell is that even though it’s not the world’s most popular language, it has a very active community. The Haskell website lists all the user groups.

If you are in Berlin, you should definitely join the FunClub.

Finally, if you can’t find an answer to your question on Stackoverflow, sign up to this mailinglist.

3 Likes

Step 0: Installation Time
Before you can start coding, you need to install a bunch of things and with Haskell that can be a pain. Luckily, Bob Ippolito wrote an excellent blog post2 explaining how to set everything up the right way.

That blog post is now a couple of years old. It contains outdated information. Home-brew does no longer offer haskell-platform, instead you can get it precompiled. Alternatively there’s a self contained Mac OS X app that includes ghc and helps you setup your stuff. cabal-dev is deprecated in favor of cabal-install for creating sandboxes.

1 Like