Beginner crash course

If you are absolutely new to Haskell, start with the Beginner crash course.


The first version of this course was delivered in person at ZuriHac, an annual Haskell hackathon. In 2020, we adapted the course somewhat in order to offer it again even as ZuriHac had to move online in order to accommodate the pandemic.

The beginner workshop at that time was set up such that participants watched a pre-recorded video at the same time and then broke into chat groups, both voice and text, to discuss the video content, ask questions, and share code examples and insights. In keeping with the very free and open spirit of ZuriHac, we decided to release the videos we had recorded for that, but – particularly because the course content has now been liberated from its original context in which we were present to answer questions – we feel it’s important to give some explanation of the design of the course and the content decisions we made.

Typically, this beginner workshop is delivered in six total hours over two days. This amount of time includes time for questions, conversation, and writing some code exercises on your own. It’s not a lot of time, and participants come with a wide variety of backgrounds: some have never programmed before, some have extensive programming experience but zero Haskell, and many participants have made one or more prior forays into learning Haskell. So, this course has never pretended to be a complete, everything you ever needed to know about Haskell course.

Instead, this course tries to focus on a few things that we usually can accomplish in the allotted time for the expected audiences. We make some choices, such as focusing on limited amounts of syntax, that a longer, more thorough introduction to Haskell might not make.

Outline

The course is grouped into four parts, each corresponding to a 90-minute session at ZuriHac 2020:

  1. The first part of this course talks about what functions are, what types are, and how Haskell brings them together into a system. We also demonstrate some basic usage of GHCi, the interactive environment that comes with the GHC compiler (or can be accessed via, for example, repl.it).

  2. The next part of this course focuses on writing a small, interactive program. In addition to introducing some basic built-in functions and types of Haskell, we also use this time to talk about how IO fits into the “pure” type system, how to figure out if a polymorphic function can be used with a specific type of data, and we introduce recursive and higher-order functions such as map.

  3. In the third part of the course,If you’re not already familiar with recursive or higher-order functions, you might find it moving more quickly than you expected. If you’re a new programmer and/or this is your first look at Haskell, you may want a helper to answer questions as you work through the second half of the course. we continue discussing recursive and higher-order functions, but we also walk through an overview of how to organize a project. In this part things start to move more quickly. We stick with a very limited syntax to avoid unnecessary distractions and make this digestible in a small amount of time.

  1. The final session of the course discusses three important typeclasses: Monoid, Functor, and Monad. Many people with only passing familiarity with Haskell have heard these words before and, often, when they register for a beginner workshop, this is the content they most want to cover. So, we have included it, although it is probably not the case that this content is “beginner” in the same sense of the word that working out how to write map is. However, we believe this material is still accessible to most people who would sign up for a “beginner” workshop in Haskell. We continue using a similar syntactic style through this section of the course, and present these concepts as an extension of things we have already done in previous sections of the course. That, of course, means that the Monad lesson does not cover every possible monad;After this course, we encourage you to consider the Validation course or book, or Functortown in order to learn more about Functor and Monad. it covers only what we need to finish the work we’re doing at the moment. We believe it is enough to understand the general idea and how it fits into the overall system of Haskell and act as a convenient step toward learning more Haskell while perhaps also satisfying people who are only mildly Haskell curious. So if you’ve ever asked what a monad is and felt dissatisfied with the answers you’ve received, this course offers a no-metaphors answer.

Join Type Classes for courses and projects to get you started and make you an expert in FP with Haskell.