Chapter 2. Haskell
In order to use Yesod, you’re going to have to know at least the basics of Haskell. Additionally, Yesod uses some features of Haskell that aren’t covered in most introductory texts. While this book assumes the reader has a basic familiarity with Haskell, this chapter is intended to fill in the gaps.
If you are already fluent in Haskell, feel free to completely skip this chapter. Also, if you would prefer to start off by getting your feet wet with Yesod, you can always come back to this chapter later as a reference.
If you are looking for a more thorough introduction to Haskell, I would recommend either Real World Haskell or Learn You a Haskell.
Terminology
Even for those familiar with Haskell as a language, there can sometimes be some confusion about terminology. Let’s establish some base terms that we can use throughout this book.
- Data type
This is one of the core building blocks for a strongly typed language like Haskell. Some data types, like
Int, can be treated as primitive values, while other data types will build on top of these to create more complicated values. For example, you might represent a person with:dataPerson=PersonTextIntHere, the
Textwould give the person’s name, and theIntwould give the person’s age. Due to its simplicity, this specific example type will recur throughout the book. There are essentially three ways you can create a new data type:A
typedeclaration such astype GearCount = Intmerely creates a synonym for an existing type. The ...