Short Introduction: How To Read This Book

In this book, we make an attempt to introduce very advanced and very technical concepts that underly Haskell language in an accessible way, using everyday analogies, pictures, and real-world examples where possible. We have a strong conviction that having a strong grasp on Types and the bigger picture in general makes any practical Haskell programmer much more efficient and productive, while also being able to fully appreciate the beauty of the mathematical concepts involved. We start with these foundations and then move to the advanced concepts of how to structure real-world big applications (a topic a lot of Haskell students struggle with) using a variety of abstractions, libraries and design patterns.

We start Chapter 1 with basic types and functions, introducing functional approach to solving problems along the way. Chapter 2 continues with algebraic data types introduction, parametric types (“type functions”), recursion and pattern match. We also look at a concise program that deals a deck of cards and uses a lot of these issues. At the end of this chapter, we “invent” a Functor. Chapter 2M focuses on a semi-formal introduction to the Type Theory. Haskell uses a weaker type system called “system-FC”, but again - understanding the bigger picture helps to both grasp Haskell abstractions as well as transition to languages such as Idris or Coq with less difficulty.

Chapter 3 is huge and focuses on Typeclasses starting with some ubiquitous algebraic examples (such as Monoid), and then dedicates a section to each of the Functor, Applicative, Monad, and moving to IO. Again, the goal is to avoid false analogies, but introduce the concepts via dependent types (and typeclasses are merely \(\sum\)-types in Type Theory) with increasingly more complex structure hierarchy. Looking at Monad as what it is - a useful abstraction applicable to many various types - helps avoid the usual confusion immensely.

Further chapters are still work-in-progress, but you can get a feeling of the direction in which we are taking this work from the chapter names.