Real World Haskell
Haskell is a deep language, and we think that learning it is a hugely rewarding experience. We will focus on three elements as we explain why. The first is novelty: we invite you to think about programming from a different and valuable perspective. The second is power: we’ll show you how to create software that is short, fast, and safe. Lastly, we offer you a lot of fun: the pleasure of applying beautiful programming techniques to solve real problems.
Haskell is most likely quite different from any language you’ve ever used before. Compared to the usual set of concepts in a programmer’s mental toolbox, functional programming offers us a profoundly different way to think about software. In Haskell, we de-emphasise code that modifies data. Instead, we focus on functions that take immutable values as input and produce new values as output. Given the same inputs, these functions always return the same results. This is a core idea behind functional programming.
Throughout this book, we will show you how Haskell’s alternatives to the features of traditional languages are powerful, flexible, and lead to reliable code. Haskell is positively crammed full of cutting edge ideas about how to create great software. Since pure code has no dealings with the outside world, and the data it works with is never modified, the kinds of nasty surprise in which one piece of code invisibly corrupts data used by another are very rare. Whatever context we use a pure function in, it will behave consistently.
We believe that it is easy to pick up the basics of Haskell programming, and that you will be able to successfully write small programs within a matter of hours or days. Since effective programming in Haskell differs greatly from other languages, you should expect that mastering both the language itself and functional programming techniques will require plenty of thought and practice. Harking back to our own days of getting started with Haskell, the good news is that the fun begins early: it’s simply an entertaining challenge to dig into a new language, in which so many commonplace ideas are different or missing, and to figure out how to write simple programs.