Yet Another Haskell Tutorial/Introduction

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Haskell
Yet Another Haskell Tutorial
Preamble
Introduction
Getting Started
Language Basics (Solutions)
Type Basics (Solutions)
IO (Solutions)
Modules (Solutions)
Advanced Language (Solutions)
Advanced Types (Solutions)
Monads (Solutions)
Advanced IO
Recursion
Complexity

This tutorial contains a whole host of example code, all of which should have been included in its distribution. If not, please refer to the links on the Haskell web site haskell.org to get it. This book is formatted to make example code stand out from the rest of the text.

Code will look like this.

Occasionally, we will refer to interaction between you and the operating system and/or the interactive shell (more on this in Section Getting started).

Example:

Interaction will look like this.

Strewn throughout the tutorial, we will often make additional notes to something written. These are often for making comparisons to other programming languages or adding helpful information.

Note

Notes will appear like this.


If we're covering a difficult or confusing topic and there is something you should watch out for, we will place a warning.

Finally, we will sometimes make reference to built-in functions (so-called Prelude-functions). This will look something like this:

-- from the Haskell prelude

map :: (a -> b) -> [a] -> [b]

Within the body text, Haskell keywords will appear like this: where, identifiers as map, types as String and classes as Eq.