Haskell can offer enormous benefits to individuals and developers who want to write high quality software, but as the saying goes, “if it were easy, everyone would do it.” The benefits of Haskell come at the cost of a steep learning curve. Haskell is hard to learn, but this book will help.

Learning Haskell can be hard in part because it’s so different from other languages you’ve probably used. This ends up being a particularly hard problem because many of the most unusual concepts that you need to learn often show up all at the same time, leading to circular dependencies in your learning plan. This book has been carefully designed, especially in the first half, to provide an on-ramp to the language that avoids the need to get into circular knowledge references.

Rather than teach you how to translate your programs from other languages, in this book you’ll develop an intuition for how to think about programs in Haskell from the ground up. This will make it easier for you to read other developers’ code, make you more effective at writing code, and help you with troubleshooting.

Most of the chapters in this book build on concepts from previous chapters, and no content in any chapter relies on concepts that have not yet been introduced. You’ll never be forced to use something that hasn’t yet been fully explained. In the last half of this book, once you have worked through the fundamental materials, you may be able to approach some material out of order if there are particular areas that you are interested in.

Some features of Haskell can seem unnecessarily complex the first time you encounter them. Some people, when they are faced with a feature that makes no sense, will assume the feature was a bad idea and give up on learning it altogether. Other people will put the concept on a pedestal and assign it disproportionate significance. In either case, the lack of motivation for the things Haskell does differently can be a barrier to learning. To help with that, each time a new concept is introduced in this book, we’ll dedicate a significant amount of time to establishing a motivation for that concept to help you better internalize the reason for the design decisions Haskell makes. Understanding the motivation will ensure you’re better positioned to make informed choices about how to design your applications, and when and how to use features of the language.

Since you’ll be learning to think about programming in an entirely new way, we’ll approach the material quite slowly in the beginning, carefully outlining all of the intermediate steps that go into executing some code and walking through multiple examples. As you approach the middle of the book, the pace will pick up, and by the last few chapters you should be learning new concepts at the pace of a native Haskell developer.

What to Expect as You Read

This book focuses on teaching through the demos and hands-on example code. Most of the chapters in this book will start with a motivating example followed by several interactive demonstrations of a concept that you can reproduce using the interactive Haskell development environment ghci. Most chapters will also include some projects you can build as you are working through material. The chapters will include all of the code you need to build a functioning minimal example, but you are encouraged to make modifications and experiment with the code as you are working through the book. At the end of each chapter you’ll also have some exercises that build on the examples you wrote. These examples will help you learn how to navigate Haskell’s documentation and work within its ecosystem to self teach, so you are better equipped to continue learning after you’ve finished the book.

Compared to other programming language communities, parts of the Haskell community can tend to be a little “math jargon” heavy. It’s not uncommon to see terms from theoretical computer science and math make their way into blog posts, articles, and even library documentation. This book aims to teach Haskell without requiring either a strong background in mathematics or familiarity with mathematical jargon. Since knowing the jargon and getting comfortable using it will ultimately help make you a more effective Haskell developer, common jargon terms will be introduced, defined, and then used consistently throughout the book. If you are skipping ahead and see some intimidating sounding language, turn back a few pages and you’re likely to find a definition and several examples to help you make sense of the words before they start being used regularly.