%
% $Header: /home/cvs/root/haskell-report/report/preface-13.verb,v 1.12 2002/12/02 11:22:02 simonpj Exp $
%
%**<title>The Haskell 98 Report: Preface</title>
%*section
%**~sheader
\markboth{PREFACE}{PREFACE}
\begin{center}
{\Large \bf Preface}
\end{center}

\vspace{.2in}

\begin{quote}
``{\em Some half dozen persons have written technically on combinatory
logic, and most of these, including ourselves, have published
something erroneous.  Since some of our fellow sinners are among the
most careful and competent logicians on the contemporary scene, we
regard this as evidence that the subject is refractory.  Thus fullness
of exposition is necessary for accuracy; and excessive condensation
would be false economy here, even more than it is ordinarily.}''
\begin{flushright}
Haskell B.~Curry and Robert Feys \\
in the Preface to {\em Combinatory Logic} \cite{curry&feys:book}, May 31, 1956
\end{flushright}
\end{quote}

\vspace{.2in}

\noindent
In September of 1987 a meeting was held at the conference on
Functional Programming
Languages and Computer Architecture (FPCA~'87) in
Portland, Oregon, to discuss an unfortunate situation
in the functional programming community: there had come into being
more than a dozen non-strict, purely functional programming languages,
all similar in expressive power and semantic underpinnings.  There
was a strong consensus at this meeting that more widespread use of
this class of functional languages\index{functional language} was
being hampered by the lack of a common language.  It was decided
that a committee should be formed to design such a language, providing
faster communication of new ideas, a stable foundation for real
applications development, and a vehicle through which others
would be encouraged to use functional languages.  This
document describes the result of that committee's efforts: a purely
functional programming language called \Haskell{},
\index{Haskell@@\Haskell{}}
named after the logician Haskell B.~Curry\index{Curry, Haskell B.}
whose work provides the logical basis for much of ours.

\subsection{Goals}

The committee's primary goal was to design a language that
satisfied these constraints:
\begin{enumerate}
\item It should be suitable for teaching, research, and applications,
      including building large systems.
\item It should be completely described via the publication of a formal
      syntax and semantics.
\item It should be freely available.  Anyone should be permitted to
      implement the language and distribute it to whomever they please.
\item It should be based on ideas that enjoy a wide consensus.  
\item It should reduce unnecessary diversity in functional 
      programming languages.
\end{enumerate}
The committee hopes that \Haskell{} can serve as a
basis for future research in language design.
We hope that extensions or
variants of the language may appear, incorporating experimental
features.

\subsection{Haskell 98}

Haskell has evolved continuously since its original publication.
By the middle of 1997, there had been four versions of the language
(the latest at that point being Haskell 1.4).  At the 1997 Haskell Workshop 
in Amsterdam, it was decided that a stable variant of Haskell was needed;
this stable language is the subject of this Report, and is called ``Haskell 98''.

Haskell 98 was conceived as a relatively minor tidy-up of Haskell 1.4, making
some simplifications, and removing some pitfalls for the unwary. It is intended to
be a ``stable'' language in sense the {\em implementors are committed to supporting
Haskell 98 exactly as specified, for the foreseeable future}.

As a separate exercise, Haskell will continue to evolve.  At the time of
writing there are Haskell implementations that support existential types,
local universal polymorphism, rank-2 types, multi-parameter type classes,
pattern guards, exceptions, concurrency, and more besides.  Haskell 98
does not impede these developments.  Instead, it provides a stable point
of reference, so that those who wish to write text books, or use Haskell
for teaching, can do so in the knowledge that Haskell 98 will continue
to exist.  On the few occasions when we refer to the evolving, future version
of Haskell, we call it ``Haskell 2''.

\subsection{This Report}

This report is the official specification of \Haskell{} 98
and should be suitable for writing programs and building
implementations.  It is {\em not} a tutorial on programming in
\Haskell{} such as the `Gentle Introduction' \cite{tutorial}, so some
familiarity with functional languages is assumed. 

Haskell 98 is described in two separate
documents: the Haskell Language Report (this document) and the Haskell
Library Report \cite{libraries}.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Highlights
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\subsection{Evolutionary Highlights}

For the benefit of those who have some knowledge of earlier
version of Haskell, we briefly summarise the differences between
Haskell 98 and its predecessors.

\subsubsection{Highlights of the August 2001 Revision}

Both Haskell 98 Reports were revised in August 2001, to incorporate
dozens of typographical errors and presentational improvements.  A
complete list of all changes can be found at @http://haskell.org@.


\subsubsection{Highlights of Haskell 98}

A complete list of the differences between Haskell 1.4 and Haskell 98
can be found at @http://haskell.org@.
A summary of the main features is as follows:
\begin{itemize}
\item List comprehensions have reverted to being list comprehensions,
not monad comprehensions.
\item There are several useful generalisations of the module system:
name clashes are reported lazily, and distinct modules can share a local
alias.
\item Fixity declarations can appear anywhere a type signature can,
and, like type signatures, bind to an entity rather than to its name.
\item ``Punning'' for records has been removed.
\item The class @Eval@ has been removed; @seq@ is now polymorphic.
\item The type @Void@ has been removed.
\end{itemize}

\subsubsection{Highlights of Haskell 1.4}

Version~1.4 of the report made the following relatively minor changes to the
language:
\begin{itemize}
\item The character set has been changed to 
Unicode\index{Unicode character set}.
\item List comprehensions have been generalized to arbitrary
monads.\index{list comprehension}
\item Import and export of class methods and constructors is no longer
restricted to `all or nothing' as previously.  Any subset of class
methods or data constructors may be selected for import or export.
Also, constructors and class methods can now be named directly on
import and export lists instead of as components of a type or class.
\item Qualified names may now be used as field names in patterns and
updates. 
\item @Ord@ is no longer a superclass of @Enum@.  Some of the default
methods for @Enum@ have changed.
\item Context restrictions on @newtype@ declarations have been relaxed.
\index{newtype declaration@@{\tt newtype} declaration}
\item The Prelude is now more explicit about some instances for @Read@
and @Show@.
\item The fixity of @>>=@ has changed.
\end{itemize}

\subsubsection{Highlights of Haskell 1.3}

Version~1.3 of the report made the following substantial 
changes to the language:

\begin{itemize}
\item Prelude and Library entities were distinguished, 
and the Library became a separate Report.
\item Monadic I/O was introduced.
\item Monadic programming was made more readable through the
introduction of a special @do@ syntax.
\item Constructor classes were introduced as a 
natural generalization of the original \Haskell{}
type system, supporting polymorphism over type constructors.
\item A number of enhancements were made to \Haskell{} type
declarations, including: strictness annotations, labelled fields, and
@newtype@ declarations.
\item A number of changes to the module system were made.
Instead of renaming, qualified names are used to resolve
name conflicts.  All names are now redefinable; there is no
longer a @PreludeCore@ module containing names that cannot be
reused.  Interface files are no longer specified by this report; all
issues of separate compilation are now left up to the implementation.
\end{itemize}


\subsection{The "n+k" Pattern Controversy}
\index{n+k pattern@@"n@+@k" pattern}
For technical reasons, many people feel that "n@+@k" patterns are
an incongruous language design feature that should be eliminated
from \Haskell{}.  On the other hand, they serve as a
vehicle for teaching introductory programming, in particular
recursion over natural numbers.  Alternatives to "n@+@k"
patterns have been explored, but are too premature to include in
\Haskell{} 98.  Thus we decided to retain this feature
at present but to discourage the use of "n@+@k" patterns by \Haskell{}
users --- see Section~\ref{patterns}.  This feature may be altered or removed in Haskell 2, 
and should be avoided.
Implementors are encouraged to provide a mechanism for users to
selectively enable or disable "n@+@k" patterns.
% The De-Wadlerization flag!


\subsection{\Haskell{} Resources}

The Haskell web site
\bprog
@
	http://haskell.org
@
\eprog
gives access to many useful resources, including:
\begin{itemize}
\item Online versions of the language and library definitions, including
a complete list of all the differences between Haskell 98 and
Haskell 1.4.
\item Tutorial material on Haskell.
\item Details of the Haskell mailing list.
\item Implementations of Haskell.
\item Contributed Haskell tools and libraries.
\item Applications of Haskell.
\end{itemize}
Particularly relevant to this Report are the following two papers:
\begin{itemize}
\item ``A static semantics for Haskell'' (Faxen) gives a formal presentation
of Haskell's type system \cite{faxen:static}.
\item 
``Typing Haskell in Haskell'' (Jones) gives a type inference algorithm for Haskell,
written in Haskell \cite{jones:thih}.
\end{itemize}

We welcome your comments, suggestions, and criticisms on the language
or its presentation in the report, via the Haskell mailing list.


\subsection*{Acknowledgements}

We heartily thank these people for their useful contributions
to this report:
Kris Aerts,
Hans Aberg,
Sten Anderson,
Richard Bird,
Stephen Blott,
Tom Blenko,
Duke Briscoe,
Paul Callaghan,
Magnus Carlsson,
Manuel Chakravarty,
Franklin Chen,
Olaf Chitil,
Chris Clack,
Guy Cousineau,
Tony Davie,
Craig Dickson,
Chris Dornan,
Laura Dutton,
Chris Fasel,
Pat Fasel, 
Sigbjorn Finne,
Michael Fryers,
Andy Gill, 
Mike Gunter,
Cordy Hall,
Mark Hall,
Thomas Hallgren,
Matt Harden,
Klemens Hemm,
Fergus Henderson,
Dean Herington,
Ralf Hinze,
Bob Hiromoto,
Nic Holt,
Ian Holyer, 
Randy Hudson,
Alexander Jacobson,
Patrick Jansson,
Robert Jeschofnik,
Orjan Johansen,
Simon B.~Jones, 
Stef Joosten, 
Mike Joy,
Stefan Kahrs,
Antti-Juhani Kaijanaho,
Jerzy Karczmarczuk,
Wolfram Karl,
Kent Karlsson,
Richard Kelsey,
Siau-Cheng Khoo, 
Amir Kishon, 
Feliks Kluzniak,
Jan Kort,
Marcin Kowalczyk,
Jose Labra,
Jeff Lewis,
Mark Lillibridge,
Bjorn Lisper,
Sandra Loosemore,
Pablo Lopez,
Olaf Lubeck, 
Ian Lynagh,
Christian Maeder,
Ketil Malde,
Simon Marlow,
Michael Marte,
Jim Mattson,
John Meacham,
Sergey Mechveliani,
Erik Meijer,
Gary Memovich,
Randy Michelsen, 
Rick Mohr,
Andy Moran,
Arthur Norman,
Nick North,
Chris Okasaki,
Bjarte M. {\O}stvold,
Paul Otto, 
Sven Panne,
Dave Parrott,
Ross Paterson,
Larne Pekowsky,
Rinus Plasmeijer,
Ian Poole,
Stephen Price,
John Robson, 
Andreas Rossberg,
George Russell,
Patrick Sansom,
Felix Schroeter,
Julian Seward,
Nimish Shah,
Christian Sievers,
Libor Skarvada,
Jan Skibinski,
Lauren Smith, 
Raman Sundaresh,
Ken Takusagawa,
Satish Thatte,
Simon Thompson,
Tom Thomson,
Tommy Thorn,
Dylan Thurston,
Mike Thyer,
Mark Tullsen,
David Tweed,
Pradeep Varma,
Malcolm Wallace,
Keith Wansbrough,
Tony Warnock,
Michael Webber,
Carl Witty,
Stuart Wray,
and Bonnie Yantis.

We are especially grateful to past members of the \Haskell{} committee --- Arvind,
Jon Fairbairn, Andy Gordon, Maria M. Guzman, 
Dick Kieburtz, Rishiyur Nikhil,
Mike Reeve, David Wise, and
Jonathan Young --- for the major contributions they have made to
previous versions of this report.
We also thank those who have participated in the lively discussions
about \Haskell{} on the FP and \Haskell{} mailing lists.

Finally, aside from the important foundational work laid by Church,
Rosser, Curry, and others on the lambda calculus, we wish to
acknowledge the influence of many noteworthy programming languages
developed over the years.  Although it is difficult to pinpoint the
origin of many ideas, we particularly wish to acknowledge the
influence of Lisp (and its modern-day incarnations Common Lisp and
Scheme); Landin's ISWIM; APL; Backus's FP
\cite{back78}; ML and Standard ML; Hope and Hope$^{+}$; Clean; Id; Gofer;
Sisal; and Turner's series of languages culminating in 
Miranda.\footnote{{\rm Miranda} is a trademark of Research
Software Ltd.} Without these forerunners \Haskell{} would not have
been possible.
%**~sfooter
