The Monad.Reader/Issue3/SoE Review - Revision history
https://wiki.haskell.org/index.php?title=The_Monad.Reader/Issue3/SoE_Review&action=history
Revision history for this page on the wikienMediaWiki 1.19.14+dfsg-1Wed, 01 Jun 2016 08:02:32 GMTGwern: /* Review: The Haskell School of Expression */ add an ext ln for state monads
https://wiki.haskell.org/index.php?title=The_Monad.Reader/Issue3/SoE_Review&diff=20875&oldid=prev
https://wiki.haskell.org/index.php?title=The_Monad.Reader/Issue3/SoE_Review&diff=20875&oldid=prev<p><span dir="auto"><span class="autocomment">Review: The Haskell School of Expression: </span> add an ext ln for state monads</span></p>
<table class='diff diff-contentalign-left'>
<tr valign='top'>
<td colspan='1' style="background-color: white; color:black;">← Older revision</td>
<td colspan='1' style="background-color: white; color:black;">Revision as of 00:44, 10 May 2008</td>
</tr></table>Sat, 10 May 2008 00:44:16 GMTGwernhttps://wiki.haskell.org/Talk:The_Monad.Reader/Issue3/SoE_ReviewGwern: fmt
https://wiki.haskell.org/index.php?title=The_Monad.Reader/Issue3/SoE_Review&diff=20866&oldid=prev
https://wiki.haskell.org/index.php?title=The_Monad.Reader/Issue3/SoE_Review&diff=20866&oldid=prev<p>fmt</p>
<table class='diff diff-contentalign-left'>
<tr valign='top'>
<td colspan='1' style="background-color: white; color:black;">← Older revision</td>
<td colspan='1' style="background-color: white; color:black;">Revision as of 00:27, 10 May 2008</td>
</tr></table>Sat, 10 May 2008 00:27:14 GMTGwernhttps://wiki.haskell.org/Talk:The_Monad.Reader/Issue3/SoE_ReviewWouterSwierstra at 14:20, 9 May 2008
https://wiki.haskell.org/index.php?title=The_Monad.Reader/Issue3/SoE_Review&diff=20834&oldid=prev
https://wiki.haskell.org/index.php?title=The_Monad.Reader/Issue3/SoE_Review&diff=20834&oldid=prev<p></p>
<p><b>New page</b></p><div>'''This article needs reformatting! Please help tidy it up.'''--[[User:WouterSwierstra|WouterSwierstra]] 14:20, 9 May 2008 (UTC)<br />
<br />
Isaac Jones' Review of '''The Haskell School of Expression''' was originally published on [http://books.slashdot.org/books/04/03/12/221232.shtml?tid=126&tid=156&tid=188&tid=192 slashdot], and is reprinted here with permission from the author.<br />
<br />
== Review: The Haskell School of Expression ==<br />
Andrew Cooke [http://books.slashdot.org/article.pl?sid=04/02/19/2257203 reviewed for Slashdot]<br />
''Purely Functional Data Structures'', which<br />
is on my book shelf next to [http://www.haskell.org/soe/ The Haskell School of Expression: Learning Functional Programming through Multimedia] by <br />
[http://www.cs.yale.edu/homes/hudak-paul.html Paul Hudak]<br />
from the <br />
[http://haskell.cs.yale.edu/yale/ Yale Haskell Group]. In his review, Cooke presented an overview of some<br />
available functional programming languages, such as [http://caml.inria.fr/ OCaml],<br />
[http://www.standardml.org/ SML], and of course<br />
[http://www.haskell.org/ Haskell]. Havoc Pennington<br />
[http://ometer.com/books.html once called Haskell] "the<br />
least-broken programming language available today." Haskell is a<br />
purely functional, lazy, staticly typed programming language. You can<br />
read [http://www.haskell.org/aboutHaskell.html more about Haskell itself here]<br />
<br />
As the title implies, '''The Haskell School of Expression''' introduces functional<br />
programming through the Haskell programming language and through the<br />
use of graphics and music. It serves as an effective introduction to<br />
both the language and the concepts behind functional programming.<br />
This text was published in 2000, but since Haskell 98 is the current<br />
standard, it is still a very relevant book.<br />
<br />
Haskell's standardization process gives us a window into two<br />
different facets of the community: Haskell is designed to be both a<br />
stable, standardized language (called Haskell 98), and a platform for<br />
experimentation in cutting-edge programming language research. So<br />
though we have a standard from 1998, the implementations (both<br />
compilers and interpreters) are continually evolving to implement new,<br />
experimental features which may or may not make it into the next<br />
standard.<br />
<br />
For instance, the [http://www.haskell.org/ghc/ Glasgow Haskell Compiler] has implemented a meta-programming environment<br />
called [http://www.haskell.org/th/ Template Haskell].<br />
Haskell is also easy to extend in directions that don't change the<br />
language itself, through the use of "Embedded Domain Specific<br />
Languages" ( [http://citeseer.ist.psu.edu/hudak96building.html EDSLs] )<br />
such as [http://www.informatik.uni-freiburg.de/~thiemann/haskell/WASH/ WASH]<br />
for web authoring, <br />
[http://www.cs.uu.nl/~daan/parsec.html Parsec] for parsing <br />
and [http://haskell.cs.yale.edu/yale/papers/dance-30-tr/index.html Dance]<br />
(more of Paul Hudak's work) for controlling humanoid robots.<br />
<br />
Before we get too far, I should offer a disclaimer. The Haskell<br />
community is rather small, and if you scour the net, you may find<br />
conversations between myself and Paul Hudak or folks in his research<br />
group, since I use some of their software. That said, I don't work<br />
directly with Hudak or his research group.<br />
<br />
In fact, the small size of the Haskell community is a useful feature. It<br />
is very easy to get involved, and folks are always willing to help<br />
newbies learn, since we love sharing what we know. You may even find<br />
that if you post a question about an exercise in<br />
''The Haskell School of Expression'', you'll get a reply from the author himself.<br />
<br />
I consider this book to be written in a "tutorial" style. It walks<br />
the reader through the building of applications, but doesn't skimp on<br />
the concepts (indeed, the chapters are meant to alternate between<br />
"concepts" and "applications.") In some ways, the code examples make<br />
it a little difficult to jump around, since you are expected to build<br />
upon previous code. The web site provides code, however, so you can<br />
always grab that and use it to fill in the missing pieces.<br />
<br />
For readers who wish to use this book as a tutorial, and to<br />
implement all of the examples (which is highly recommended), I suggest<br />
that you<br />
[http://cvs.haskell.org/Hugs/pages/downloading-Nov2002.htm grab]<br />
the [http://www.haskell.org/hugs/ Hugs interpreter] and<br />
read the<br />
[http://cvs.haskell.org/Hugs/pages/users_guide/index.html User's Guide] while you're reading the first few chapters of<br />
''The Haskell School of Expression''. Hugs is very portable, free, and easy to use. It<br />
also has an<br />
[http://www.haskell.org/haskell-mode/ interface with Emacs].<br />
Unfortunately, some of the example code has bit-rotted a little, and<br />
certain things don't work out-of-the-box for X11-based systems. The<br />
bit-rot can be solved by using the "November 2002" version of Hugs.<br />
This is all [http://www.haskell.org/soe/source.htm explained] on ''School of Expression''<br />
's<br />
[http://www.haskell.org/soe/ web page].<br />
<br />
''The Haskell School of Expression'' should be very<br />
effective for programmers who have experience in more traditional<br />
languages, and programmers with a Lisp background can probably move<br />
quickly through some of the early material. If you've never learned a<br />
functional language, I definitely recommend Haskell: Since Haskell is<br />
''purely'' functional (unlike Lisp), it will more or less prevent<br />
you from "cheating" by reverting to a non-functional style. In fact,<br />
if you've never really looked at functional programming languages, it<br />
may surprise you to learn that Haskell has no looping constructs or<br />
destructive assignment (no {{{x = x + 1}}}). All of the tasks<br />
that you would accomplish through the use of loops is accomplished<br />
instead through recursion, or through higher-level abstractions upon<br />
recursion.<br />
<br />
Since I was already comfortable with recursion when I started this<br />
book, it is hard for me to gauge how a reader who has never<br />
encountered recursion would find this book's explanation of the concept. ''The Haskell School of Expression''<br />
introduces recursion early on, in section 1.4. It is used in examples<br />
throughout the book, and if you follow along with these examples, you<br />
will most certainly be using it a lot. The introduction seems natural<br />
enough to me, but I note that Hudak does not give the reader any extra<br />
insight or tricks to help them along. Not to worry, though; recursion<br />
is very natural in Haskell and the reader may not even notice that<br />
they are doing something a little tricky.<br />
<br />
The use of multimedia was a lot of fun for me, and should quickly<br />
dispel the myth that IO is difficult in Haskell. For instance, Hudak<br />
has the reader drawing fractals by page 44, and throughout the book,<br />
the reader will be drawing shapes, playing music, and controlling<br />
animated robots.<br />
<br />
Any book on Haskell must be appraised for its explanation of<br />
''monads'' in general and IO specifically. Monads are a purely<br />
functional way to elegantly carry state across several computations<br />
(rather than passing state explicitly as a parameter to each<br />
function). They are a common stumbling block in learning Haskell,<br />
though in my opinion, their difficulty is over-hyped.<br />
<br />
Since input and output cause side-effects, they are not purely<br />
functional, and don't fit nicely into a function-call and recursion<br />
structure. Haskell has therefore evolved a way to deal safely and<br />
logically with IO through the use of monads, which encapsulate mutable<br />
state. In order to perform IO in Haskell, one must use monads, but<br />
not necessarily understand them.<br />
<br />
Some people find monads confusing; I've even heard a joke that you<br />
need a Ph.D. in computer science in order to perform IO in Haskell.<br />
This is clearly not true, and this book takes an approach which I<br />
whole-heartedly agree with. It gets the reader using monads and IO in<br />
chapter 3 without explaining them deeply until chapters 16 (IO) and 18<br />
(monads). By the time you get there, if you have heard that monads<br />
are confusing, you might be inclined to say "how is this different<br />
from what we've been doing all along?" Over all, I was pleased with<br />
the explanation of monads, especially ''state monads'' in chapter<br />
18, but I felt that the reader is not given enough exercises where<br />
they implement their own monads.<br />
<br />
If you're worried that drawing shapes and playing music will not<br />
appeal to your mathematic side, you will be pleased by the focus on<br />
algebraic reasoning for shapes (section 8.3) and music (section 21.2),<br />
and a chapter on proof by induction (chapter 11).<br />
<br />
After reading this book you will be prepared to take either of the<br />
two paths that Haskell is designed for: You can start writing<br />
[http://www.abridgegame.org/darcs/ useful and elegant tools],<br />
or you can dig into the fascinating programming language research<br />
going on. You will be prepared to approach ''arrows'', a newer<br />
addition to Haskell which, like monads, have a deep relationship to<br />
category theory. [http://www.haskell.org/arrows/ Arrows]<br />
are used extensively in some of the Yale Haskell group's<br />
[http://www.haskell.org/yale/publications.html recent work].<br />
You will see a lot of shared concepts between the animation in<br />
''The Haskell School of Expression'' and Yale's "Functional<br />
Reactive Programming" framework, [http://www.haskell.org/yampa/ Yampa]. If you like<br />
[http://c2.com/cgi/wiki?LittleLanguage little languages],<br />
you'll appreciate how useful Haskell is for embedded domain specific<br />
languages. It <br />
[http://www.cse.unsw.edu.au/~sseefried/files/sseefried03th-pan.pdf may be even more useful] now that<br />
[http://www.haskell.org/th/ Template Haskell] is in the<br />
works. [http://books.slashdot.org/article.pl?sid=04/02/19/2257203 Andrew Cooke described] ''Purely Functional Data Structures'' as<br />
a great ''second'' book on functional programming. In my opinion,<br />
''The Haskell School of Expression'' is the great first book<br />
you're looking for.<br />
<br />
-- [http://www.syntaxpolice.org Isaac Jones]<br />
----<br />
CategoryArticle</div>Fri, 09 May 2008 14:20:56 GMTWouterSwierstrahttps://wiki.haskell.org/Talk:The_Monad.Reader/Issue3/SoE_Review