For Beginners

People ask me a lot how they can best get started with programming, functional programming, or Haskell specifically. Of course, I think my book, which was written for beginners, is a great place to start, but people have different needs. I’m going to try to collect here the things that I have personally found most helpful for getting started with programming and with Haskell. It’s an opinionated collection. It might not be perfectly suited to your needs, but these are things that worked for me.

Table of Contents

What to Do First
Books
No Monads for You
Blog Posts and Tutorials
- Lambda Calculus
- Haskell Basics
- Functional Patterns
- Awesome Typeclasses
General Programming
- Git

What to do first

OK, you’re here looking at a Haskell-ish blog already so maybe you don’t need this advice. But. Just in case.

This Getting Started guide will help you get set up quickly. For more in depth instructions, as well as guides in foreign languages, try the Learn Haskell repo maintained by Chris Allen.

I do recommend you just get Stack right off the bat and look through some of its documentation. The documentation for it is thorough and clear. Chris Allen and I also made a video about using Stack. The video is long, but that’s because we cover a bunch of weird edge cases that you may never encounter. There are time stamps in the information that you can click on to get what you need.

If you are itching to see how a project is set up in Haskell, try Chris’s How I Start: Haskell article and enjoy processing some CSV data.

Books

When we’re talking about learning resources, I am very opinionated. In the course of writing our Haskell book, I have read most of the other Haskell books. I recognize that not everyone’s judgments here will be the same as mine, but these are what worked best for me (totally new programmer with not a lot of math background):

No Monads for You

A lot of people who have experience programming in other languages think the big thing they need to learn about Haskell is monads and try to start there. So, here are my suggestions for beginning monads:

Blog Posts and Tutorials

Good, good, now that you’ve decided to forego learning about monads until you have a better understanding of types, typeclasses, functors and all that, here are some blog posts and tutorials from around the web that I found helpful. Even if you are working through a book, getting the same lesson presented differently, with different wording and examples, can help.

Lambda Calculus

Wait, what? I know. If you’d told me as a senior at university suffering through formal logic that, at the age of 40, lambda calculus would suddenly become very relevant to my interests, I’d surely have scoffed. But it’s true! Haskell is a lambda calculus, so understanding it in its simplest form (not easiest, but simplest in the sense of “without all the fancy syntax”) can help tremendously. We started our book with a chapter on lambda calculus, but here are some other ways to dive in:

Haskell Basics

Some of the posts listed here go beyond basic function application and types. You may find you only understand half the post the first time you read it (or less sometimes, if you’re like me!). That’s cool. What I did is bookmark them and keep coming back to them as I learned more and I was able to recognize how much progress I was making by seeing how much more I understood each time.

It’s a mindset change. I wish I’d known this earlier as it would’ve saved me frustration and doubt, but you kind of need to unlearn what you think you know about coding, then go back to the basics.
This person has the right idea..

Functional Patterns

Awesome Typeclasses

The problem with most blog posts about functors, applicatives, and monads is less that they have analogies to food items and more that they miss the point that all of those big typeclasses are generalizations of basic patterns. What we want to do is apply and compose functions in the presence of structure, and these are ways of doing it. None of these typeclasses are magic, and they all exist to solve common programming problems. They’re things you might well have written yourself, but in Haskell, we’ve just pulled them out into typeclasses to make them reusable with a lot of different types of structure. I mean, I say “we” but obviously this was done by smarter people than I am.

They did that with monoids, too, and even though you’re thinking “monoid” sounds like some unfortunate disease, it’s a pattern you’re familiar with – addition, multiplication, and list concatenation are all monoids.

The Typeclassopedia is one of the things people told me to read when I was a beginner, and it was way over my head. However, once you’re ready for it, it’s an invaluable source of information about important typeclasses. You might try going through it as you’re working through the NICTA course. Heh.

General Programming

Git

If you don’t already know git, you need to. One thing I’d like to note, because this wasn’t very clear to me for a long time, is that git is not GitHub. I use git mostly from the command line, so for me, when I move a repository from GitHub to Gitlab (or vice versa), I change the address of what I’m pushing to and pulling from, but the commands themselves don’t change. The first time I moved something from GitHub to Gitlab, I didn’t realize that would be true, and I thought I’d have to learn new things. Every experienced programmer is probably shaking their heads at me now, but if putting this out in public will prevent any one person from having the same fear, then so be it. That said, I highly encourage you to learn git from the command line. Here are some places to get started.

Read this first, because it’s reassuring and also has links (at the bottom) to the two best sources of understanding git’s underlying model that I know of. I don’t have a preference between them. I strongly urge you to familiarize yourself with the underlying structure of git. Having that model in your head will help you diagnose problems when they arise and use a search engine to find commands that you need. It’s hard to search for git commands if you’re not sure what you need to do, and having an idea of the underlying structure helps you know what you need to do.

This doesn’t explain very much about git’s underlying model, but is a good, quick starting point that explains the most commonly used commands, and it’ll serve as a good reference as you’re learning.