8.1 Introducing Haskell

As always, to understand why a language embraces a certain set of compromises, you should start with the history. In the early and mid-1980s, pure functional programming splintered across several languages. The key concepts driving new research were lazy processing, as we encountered in Clojure, and pure functional programming. A group from the Functional Programming Languages and Computer Architecture conference in 1987 formed and decided to build an open standard for a pure functional language. Out of that group, Haskell was born in 1990 and revised again in 1998. The current standard, called Haskell 98, has been revised several times, including a revision of Haskell 98 and the definition of a new version of Haskell called Haskell Prime. So, Haskell was built from the ground up to be a pure functional language, combining ideas from the best functional languages, with special emphasis on lazy processing.

Haskell has strong, static typing, like Scala. The type model is mostly inferred and is widely considered to be one of the most effective type systems of any functional language. You’ll see that the type system allows for polymorphism and very clean designs.

Haskell also supports other concepts you’ve seen in this book. Haskell allows Erlang-style pattern matching and guards. You’ll also find Clojure-style lazy evaluation and list comprehensions from both Clojure and Erlang.

As a pure functional language, Haskell does not do side effects. Instead, a function can return a side effect, which is later executed. You’ll see an example of this in day 3, as well as an example of preserving state using a concept called monads.

The first couple of days will get you through typical functional programming concepts, such as expressions, defining functions, higher-order functions, and the like. We’ll also get into Haskell’s typing model, which will give you some new concepts. Day 3 will stretch you. We’ll look at the parameterized type system and monads, which are sometimes difficult concepts to grasp. Let’s get started.