[Haskell-cafe] about Haskell code written to be "too smart"

wren ng thornton wren at freegeek.org
Wed Mar 25 16:21:19 EDT 2009


Manlio Perillo wrote:
> The main problem, here, is that:
> - recursion and pattern matching are explained in every tutorial about
>   functional programming and Haskell.
> 
>   This is the reason why I find them more "natural".
> 
> - high level, Haskell specific, abstractions, are *not* explained in
>   normal tutorials or books.
>   The libraries where these concepts are implemented, are not well
>   documented.

This latter point is indeed the problem. But it may be worth rephrasing 
a bit. The big problem with the Haskell tutorials I've seen is that they 
aim to teach orthodoxy rather than orthopraxy. Or to put it less 
religiously, they teach the nuts and bolts of how the language is 
_constructed_, instead of teaching the idioms and ideas of how the 
language is _used_. It's like learning C from Kernighan&Ritchie ---a 
fine book, don't get me wrong, but it teaches the words of the language 
instead of the community of the speakers. If you've memorized K&R you're 
still a novice C programmer.

Given our history, this approach made sense. Haskell's been around for a 
long time, but most of that history has been in academia where it's 
assumed that people will know what to do if only they knew how to do it. 
More recently Haskell has been moving from academic toy to industrial 
tool, and that shift necessitates a similar shift from teaching the 
language as a collection of interesting features to teaching the 
language as a collection of interesting libraries. History hinders this 
transition--- both the internal history of those who know Haskell (and 
thus can teach it but only as they know it), and also the external 
history of the mainstream which understands imperativistic thinking but 
not functional declarative thinking (and thus we must teach the features 
in order to give the understanding necessary for teaching the libraries).


Recently Galois has been focusing on developing the infrastructure 
necessary for having easy access to libraries. To this day CPAN is the 
reason why Perl is one of the best languages out there. Other languages 
have tried emulating that repository, but the only one I've seen that 
has the community necessary to make it fly has been Hackage; and the 
development of Cabal/Hackage is very recent and still very bleeding edge 
(with the scars to prove it). With Galois' support, I think most 
Haskellers are aware of Hackage now, however it still hasn't made it 
into the tutorials in the same way that CPAN is integral to the teaching 
of Perl.

Real World Haskell is another groundbreaking, but recent, development. 
It's a great book in itself and groundbreaking for embracing 
open-development in the publishing industry, but it's also the first of 
this shift from teaching Haskell = Patterns + Recursion + Laziness + 
Class to teaching modern Haskell in a more holistic community-oriented 
way. It's worth reiterating that RWH was not the cause of the shift in 
the community, but is rather a result of the ongoing shift. The 
Typeclassopedia is another drop in this river: excellent, recent.

So I agree that most of the tutorials are lagging behind the modern form 
of Haskell, but I think this is due in part to a very recent change in 
the growth and direction of the community. As always with avoiding 
success at all costs, whether we end up the better for it in the end 
will depend on holding onto enough newcomers who have only ever known 
this modern Haskell, because they are the ones who will have the proper 
perspective to write tutorials and teach the language as if it's always 
been this way. You must be the change you wish to see in the world.


>   Most of the "documentation" is in research papers, and a "normal"
>   programmer don't want to read these papers.

Yes, and no. There is quite a bit of documentation in research papers, 
and mainstream programmers don't read research. However, this is a big 
part of what makes the Haskell community what it is. There are plenty of 
non-academics here, but they have the willingness to read these papers 
(even if it's out of the ordinary) and the desire to learn radical new 
things (because they're out of the ordinary). A good deal of the papers 
these days are eminently readable by the laity, moreso than other 
research papers in computer science or programming languages IMO.

This is one of the big things that separates Haskell from the 
mainstream, but it's not something I see going away any time soon. Given 
the recent surge of interest from the mainstream, I think it's finally 
time that we take a more proactive approach in trying to teach this 
aspect as one of the tenants of our community. Presently there's still a 
"take it or leave it" tenor to these discussions, and that needs to be 
dispelled before it poisons the relations between the old guard and the 
young turks. New tutorials need to find some way of introducing 
non-academics to the idea that the academy is not an ivory tower and 
that part of what makes Haskell cool is the fact that it takes these 
theoretical ideas and applies them to the real world. It's challenging 
to fight anti-intellectualism anywhere, but it's become apparent to me 
that this is something that we need to develop an organized response to.

-- 
Live well,
~wren


More information about the Haskell-Cafe mailing list