From Wikibooks, open books for an open world
Jump to: navigation, search


Loupe light.svg

Haskell is a functional programming language. If you've programmed before and would like to see a little bit of how Haskell works and is different from other programming languages, see the overview.

Haskell is unique in two ways. First, it is a pure functional programming language. If you have a function and you call it twice in two different places with the same arguments then it will return exactly the same value both times. Second, Haskell provides a very modern type system which incorporates features like typeclasses and generalized algebraic data types. (we hope terms like these will roll smoothly off your tongue by the time you're done.)

So, why do Haskellers like their language? Haskell programmers enjoy their work because dealing with only pure functions makes code much easier to understand, and a function's correctness much easier to analyze and even prove. Moreover, having an advanced type system helps catch mistakes, both silly and profound.

In this book we aim to introduce you both to the Haskell language, from the very basics to the most advanced features, and to computer programming in general. Seasoned programmers, we urge you to be especially patient with this process. In all likelihood, the languages you are most familiar with differ greatly from Haskell, and habits from those languages might make it more difficult to understand how things work: simple, but different. So let learning to see the world through the warped and mathematical mindset of a functional programmer be an adventure, a brave new world.


The book is divided into three sections: the Beginner's Track, the Advanced Track, and Haskell in Practice, which is designed to cover the more day-to-day issues, and is readable with knowledge of the Beginner's Track.

Beginner's Track[edit]

This section will introduce you to the very basics of the language and some of the more frequently used libraries. This will enable you to build simple programs and prepare you for the advanced track.

Most chapters contain exercises where you can test yourself on what you learned in that chapter. At the end of each chapter is a link to the solutions, so you can check if your solution is correct.

Haskell Basics[edit]

Elementary Haskell[edit]

Intermediate Haskell[edit]


Advanced Track[edit]

This section will introduce wider functional programming concepts such as different data structures and type theory. It will also cover more practical topics like concurrency.

Advanced Haskell[edit]

Fun with Types[edit]

Wider Theory[edit]

Haskell Performance[edit]

Haskell in Practice[edit]

This section covers the more day-to-day issues of working with Haskell, issues such as making use of the standard library, building graphical interfaces or working with databases. You should be able to jump directly to this section from the basic track.

Libraries Reference[edit]

General Practices[edit]

Specialised Tasks[edit]


Syntactic sugar
Answers to exercises
Authors and Acknowledgements

About the book[edit]

Notes for contributors
Style conventions
To do
Templates for the Haskell wikibook
Experimental Modules
List of topics

Other Haskell tutorials[edit]

  • Haskell Meta-tutorial - the tutorial to find other tutorials
  • Learn You a Haskell for Great Good - Gratis (CC-BY-NC-SA license) tutorial aimed at beginners who have may have experience in imperative programming languages but haven't programmed in a functional language before.
  • Real World Haskell - an O'Reilly book, available online at no charge (CC-BY-NC license). Built around case studies of practical applications.
  • Write Yourself a Scheme in 48 Hours - (imported here) An alternate approach to teaching Haskell (and perhaps Scheme), aimed at a more advanced audience (though not necessarily one that knows how to program!)
  • Yet Another Haskell Tutorial - (imported here) is aimed at beginners and takes a practical approach to things — now part of this wikibook, in process of being mixed into the main text.

Additional resources[edit]