File: intro.html

package info (click to toggle)
hugs 1.4.199801-1
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 7,220 kB
  • ctags: 5,609
  • sloc: ansic: 32,083; haskell: 12,143; yacc: 949; perl: 823; sh: 602; makefile: 236
file content (56 lines) | stat: -rw-r--r-- 3,800 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

<title>A Gentle Introduction to Haskell: Introduction</title>
<body bgcolor="#ffffff"><i>A Gentle Introduction to Haskell, Version 1.4</i><br><a href="goodies.html">next</a> <a href="index.html">top</a><hr>
<a name="tut-intro"></a><p>
<a name="sect1"></a>
<h2>1<tt>&nbsp;&nbsp;</tt>Introduction</h2>
<p>
Our purpose in writing this tutorial is not to teach programming, nor
even to teach functional programming.  Rather, it is intended to serve
as a supplement to the Haskell Report [<a href="haskell-tutorial.html#$haskell-14">3</a>], which is
otherwise a rather dense technical exposition.  Our goal is to provide
a gentle introduction to Haskell for someone who has experience with
at least one other language, preferably a functional language (even if
only an "almost-functional" language such as ML or Scheme).  If the
reader wishes to learn more about the functional programming style, we
highly recommend Bird and Wadler's text <I>Introduction to
Functional Programming</I> [<a href="haskell-tutorial.html#$birdwadler88">1</a>], which uses a language
sufficiently similar to Haskell to make translation between the two
quite easy.  For a useful survey of functional programming languages
and techniques, including some of the language design principles used
in Haskell, see [<a href="haskell-tutorial.html#$huda89a">2</a>].<p>
The Haskell language has evolved significantly since its birth in 1987.
This tutorial deals with <a href="http://haskell.org/report">version 1.4</a> of the Haskell report.  This 
version is nearly identical the prior 1.3 version; either the 1.3 or
the 1.4 report can be used in conjunction with this tutorial.  Older
versions of the Haskell report are now obsolete.<p>
Our general strategy for introducing language features is this:
motivate the idea, define some terms, give some examples, and then
point to the Report for details.  We suggest, however, that the reader
completely ignore the details until the Gentle Introduction has been
completely read.  On the other hand, Haskell's Standard Prelude (in
Appendix A of the Report and the standard libraries
(found in the <a href="http://haskell.org/library"></a>Library Report[<a href="haskell-tutorial.html#$haskell-libs">4</a>]) contain
lots of useful examples of Haskell code; we 
encourage a thorough reading once this tutorial is completed.  This
will not only give the reader a feel for what real Haskell code looks
like, but will also familiarize her with Haskell's standard set of
predefined functions and types.<p>
[We have also taken the course of not laying out a plethora of
lexical syntax rules at the outset.  Rather, we introduce them
incrementally as our examples demand, and enclose them in brackets, as
with this paragraph.  This is in stark contrast to the organization of
the Report, although the Report remains the authoritative source for
details (references such as "report section 2.1" refer to sections in the
Report).]<p>
Haskell is a <I>typeful</I> programming language: (A phrase due
to Luca Cardelli.) Types are pervasive, and the newcomer is best off
becoming well-aware of the full power and complexity of Haskell's type
system from the outset.  For those whose only experience is with
relatively "untypeful" languages such as Perl, Tcl, or Scheme, this may be
a difficult adjustment; for those familiar with Java, C, Modula, or
even ML, the adjustment should be easier but still not insignificant,
since Haskell's type system is different and somewhat richer than
most.  In any case, "typeful programming" is part of the Haskell
programming experience, and cannot be avoided.<p>
<hr><body bgcolor="#ffffff"><i>A Gentle Introduction to Haskell, Version 1.4</i><br><a href="goodies.html">next</a> <a href="index.html">top</a>