[OT] Teaching Haskell in High School

John Peterson peterson-john@cs.yale.edu
Tue, 4 Feb 2003 10:21:19 -0500


> For exactly these reasons we have implemented Helium; not for replacing
> Haskell (we're very happy with Haskell), but for *learning* Haskell. There
> is no overloading, so types and type errors are easier to understand. The
> Helium compiler produces warnings for situations that are probably
> incorrect.

> I'm curious what the other "gotcha's" are that John refers to because it
> might give
> us inspiration for more warnings/language design decisions.


I've been negligent in not playing with Helium yet - I'm sure that
this sort of system is going to be a significant improvement for this
sort of audience.  I'm also hoping that Helium can be adapted into
other problem domains which use typed functional languages.

As far as language gotchas, the issue is much more in the way the
programming environment responds to a problem than in the language
design.  If a system can generate a sensible response / suggestion
when a student makes an error then I don't think there's any
particular problem.

Another issue is in how the material is presented - I think this makes
a big difference in what errors a student is likely to encounter.
When you teach in a slow, constructive manner I think you're less
likely to encounter problems than in my case, where I was teaching
from a mathematics perspective and asking students to transcribe their
mathematical ideas directly into Haskell and hope that they work.

Notationally, there were three problems that hit students hard and
generated error messages that had nothing to do with their mistake.
The numeric syntax requires digits on both sides of a decimal.
Mistakes like
a = .2
were extremely common.  Unary minus was also a big problem - I
"solved" this by requiring all negative number to be wrapped in
parens.  The varid / conid stuff also was a problem - it was hard to
explain why a = 1 is OK and A = 1 isn't.  This definitely was a
problem with going straight into programming from math.

There were a lot of problems with type errors.  The numeric type
classes pop up unexpectedly in error messages, rendering them
cryptic.  Monomorphism also caused some problems but as I recall it
was the old Hugs that didn't handle monomorphism quite right anyway. 

Debugging was a serious problem - we basicly gave up on that.  Since
the programs were fairly short I could usually spot bugs fairly easily
but I couldn't get students to do this on their own.

Sorry if this isn't very precise - it's been a while.

    John