[Haskell-cafe] Tutorial on Haskell
rfhayes at reillyhayes.com
Tue Apr 17 19:19:21 EDT 2007
In my opinion, one of the things that makes Haskell difficult to
learn is the value system. I'm not referring to "pure" vs.
"impure". Instead, I am referring to the beliefs and principles held
by the Haskell community that are not shared with most of the
programming world. Principles like "It is valuable to be able to
reason about programs rigorously". This is foreign to most
developers. When they get to the section of a Haskell book that
starts talking about this, their eyes glaze over and they skip over
to the "more practical stuff". By the time they get to Monads
they're ready to rip their eyes out because the book is "too
theoretical" or "too academic".
One of the truly powerful things about Haskell is the short distance
between theory and practicality. The problem is how to demonstrate
this convincingly. The ability to prove a program's correctness is
regularly trotted out for show in this arena (or at least the lighter-
weight claim that programs that compile usually work). I don't think
that most developers (and certainly not the OSCON crowd) are ready to
drink that kool-aid. They *enjoy* debugging and are tired of the
"static" vs. "dynamic" debate. But the ability to reason about
programs has borne fruit that I *do* think they will appreciate.
Because many of them care about performance.
I don't need to tell the subscribers to this list that the shockingly
good performance of code written using Data.ByteString.Lazy is a
direct result of being able to reason about programs. Obviously, the
details of the fusion techniques are outside the scope of any
introductory tutorial. But I think it would be useful to quickly
implement a "wc -l" equivalent and explain why it's faster than the
simple C equivalent. Nothing overly deep, just draw the line from
"reasoning about programs" to "fusion" and on to "amazing
performance" (capping it off with the fact the the fusion
optimization is in the *Library*, not baked in to the compiler). At
a minimum, it shows that being able to reason about programs
rigorously can have a payoff in a currency that they value.
On Apr 16, 2007, at 1:34 AM, Simon Peyton-Jones wrote:
> I have agreed to give a 3-hr tutorial on Haskell at the Open Source
> Convention 2007
> I'm quite excited about this: it is a great opportunity to expose
> Haskell to a bunch of smart folk, many of whom won't know much
> about Haskell. My guess is that they'll be Linux/Perl/Ruby types,
> and they'll be practitioners rather than pointy-headed academics.
> One possibility is to do a tutorial along the lines of "here's how
> to reverse a list", "here's what a type is" etc; you know the kind
> of thing. But instead, I'd prefer to show them programs that they
> might consider *useful* rather than cute, and introduce the
> language along the way, as it were.
> So this message is to ask you for your advice. Many of you are
> exactly the kind of folk that come to OSCON --- except that you
> know Haskell. So help me out:
> Suggest concrete examples of programs that are
> * small
> * useful
> * demonstrate Haskell's power
> * preferably something that might be a bit
> tricky in another language
> For example, a possible unifying theme would be this:
> Another might be Don's cpu-scaling example
> But there must be lots of others. For example, there are lots in
> the blog entries that Don collects for the Haskell Weekly
> Newsletter. But I'd like to use you as a filter: tell me your
> favourites, the examples you find compelling. (It doesn't have to
> be *your* program... a URL to a great blog entry is just fine.) Of
> course I'll give credit to the author.
> Remember, the goal is _not_ "explain monads". It's "Haskell is a
> great way to Get The Job Done".
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe