About This Report
The goal of the
Yet Another Haskell Tutorial
is to provide a complete introduction tothe Haskell programming language. It assumes no knowledge of the Haskell languageor familiarity with functional programming in general. However, general familiaritywith programming concepts (such as algorithms) will be helpful. This is not intendedto be an introduction to programming in general; rather, to programming in Haskell.Sufﬁcient familiarity with your operating system and a text editor is also necessary(this report only discusses installation on conﬁguration on Windows and *Nix system;other operating systems may be supported – consult the documentation of your chosencompiler for more information on installing on other platforms).
What is Haskell?
Haskell is called a lazy, pure functional programming language. It is called
be-cause expressions which are not needed to determine the answer to a problem are notevaluated. The opposite of lazy is
, which is the evaluation strategy of most com-mon programming languages (C, C++, Java, even ML). A strict language is one inwhich every expression is evaluated, whether the result of its computation is importantor not. (This is probably not entirely true as optimizing compilers for strict languagesoftendo what’s called“deadcodeelimination”–this removesunusedexpressionsfromthe program.) It is called
because it does not allow side effects (A side effect issomething that affects the “state” of the world. For instance, a function that printssomething to the screen is said to be side-effecting, as is a function which affects thevalue of a global variable.) – of course, a programming language without side effectswould be horribly useless; Haskell uses a system of
to isolate all impure com-putations fromthe rest of the programand performthem in the safe way (see Chapter 9for a discussion of monads proper or Chapter 5 for how to do input/output in a purelanguage).Haskell is called a
language because the evaluation of a program isequivalent to evaluating a function in the pure mathematical sense. This also differsfrom standard languages (like C and Java) which evaluate a sequence of statements,one after the other (this is termed an