Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword or section
Like this

Table Of Contents

0 of .
Results for:
No results containing your search query
P. 1
Haskel Tutorial

Haskel Tutorial

|Views: 132|Likes:
Published by devilvsevil

More info:

Published by: devilvsevil on Oct 23, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





Yet Another Haskell Tutorial
Hal Daum´e IIICopyright (c) Hal Daume III, 2002-2006. The preprint version of this tutorial isintended to be free to the entire Haskell community, so we grant permission to copyand distribute it for any purpose, provided that it is reproduced in its entirety, in-cluding this notice. Modified versions may not be distributed without prior concentof the author, and must still maintain a copy of this notice. The author retains theright to change or modify this copyright at any time, as well as to make the book nolonger free of charge.
About This Report
The goal of the
Yet Another Haskell Tutorial
is to provide a complete intoduction 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.Sufficient familiarity with your operating system and a text editor is also necessary(this report only discusses installation on configuration 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 opposize of lazy is
, which is the evaluation strategry of mostcommon 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 languagesoften do what’s called “dead code elmination” – this removes unused expressions fromthe program.) It is called
because it does not allow side effects (A side effectis something 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 from the rest of the program and perform them 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
The History of Haskell
The history of Haskell is best described using the words of the authors. The followingtext is quoted from the published version of the Haskell 98 Report:In September of 1987 a meeting was held at the conference on FunctionalProgramming Languages and Computer Architecture (FPCA ’87) in Port-land, Oregon, to discuss an unfortunate situation in the functional pro-gramming community: there had come into being more than a dozen non-strict, purely functional programming languages, all similar in expressivepower and semantic underpinnings. There was a strong consensus at thismeetingthatmorewidespreaduseofthisclassoffunctionallanguages wasbeing hampered by the lack of a common language. It was decided that acommittee should be formed to design such a language, providing fastercommunication of new ideas, a stable foundation for real applications de-velopment, and a vehicle through which others would be encouraged touse functional languages. This document describes the result of that com-mittee’sefforts: apurelyfunctional programming language calledHaskell,named after the logician Haskell B. Curry whose work provides the logicalbasis for much of ours.The committee’s primary goal was to design a language that satisfied theseconstraints:1. It should be suitable for teaching, research, and applications, includ-ing building large systems.2. It should be completely described via the publication of a formalsyntax and semantics.3. It should be freely available. Anyone should be permitted to imple-ment the language and distribute it to whomever they please.4. It should be based on ideas that enjoy a wide consensus.5. It should reduce unnecessary diversity in functional programminglanguages.The committee intended that Haskell would serve as a basis for futureresearch in language design, and hoped that extensions or variants of thelanguage would appear, incorporating experimental features.Haskell has indeed evolved continuously since its original publication. Bythe middle of 1997, there had been four iterations of the language design(the latest at that point being Haskell 1.4). At the 1997 Haskell Workshopin Amsterdam, it was decided that a stable variant of Haskell was needed;this stable language is the subject of this Report, and is called “Haskell98”.Haskell 98 was conceived as a relatively minor tidy-up of Haskell 1.4,making some simplifications, and removing some pitfalls for the unwary.

Activity (3)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
chandrapcnath liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->