[Haskell-cafe] Teaching High-School one-semester FP (using Haskell)

Chris Smith cdsmith at gmail.com
Fri Dec 11 12:55:07 UTC 2020


Hi Zachi,

This is a really interesting project, and related to things I'm working
on.  Regardless of whether you take my advice, I'm very interested in
hearing how it goes.  Teaching Haskell at younger ages is something I care
deeply about.

Over the last nine years or so, I have built a web-based platform called
CodeWorld, which you might find useful for your class.  CodeWorld provides
two things:

- A way to get your students started quickly and easily in class, without
waiting for them to install GHC, Cabal/Stack, etc.
- An easy graphics and UI library with a purely functional style.  This
architecture, known by various crowds as "functional MVC", "the universe
model" (by the Racket community), "Glossy programs" (by Haskellers), or
most of "the Elm architecture" (by the Elm community) is a real gem of
functional programming education, and lets your students experience
declarative programming and build cooI things easily, without needing to
get bogged down in stuff like I/O, recursion, etc.

Putting these things together, I typically get 13-year-olds to write their
first working Haskell program and make creative choices about it on the
first day of school.

There are two ways to use CodeWorld:

1. https://code.world/haskell is basically Haskell in the web browser,
along with the purely functional graphics library
<https://hackage.haskell.org/package/codeworld-api> mentioned above.  A large
number of widely used Haskell packages
<https://github.com/google/codeworld/blob/master/codeworld-available-pkgs/codeworld-available-pkgs.cabal#L14>
are available for import, as well.

2. https://code.world is the same thing, but also using an educational
dialect of the language that I have found to be much easier for absolute
beginners to pick up and work with.  The main changes from standard Haskell
are that type classes are completely removed, all library functions are
uncurried, the compiler rejects certain error-prone things students do by
accident, and many of the error messages are rewritten.  The drawback,
though, is that while the code your students would write here is compiled
by GHC(JS), it's not "ordinary" Haskell, so your students wouldn't be able
to rely on other random learning resources from the Internet or use most
existing third-party libraries.  In their place, there is a somewhat
involved online Guide that introduces the language and standard
library, and both I myself and LSU's Gordon Cain Center have produced
different learning materials for ages ~ 13-17 years, tailored for this
educational dialect.  Happy to chat more or get you in touch with people
from the LSU team, if you are interested in going that route.

If CodeWorld isn't right for your class and you would prefer more
traditional Haskell tooling, I still recommend adopting the same graphics
architecture, and one way to do so is to use Gloss
<https://hackage.haskell.org/package/gloss>, a very well-known Haskell
implementation that's been around for ages and is widely used for
education, graphics demos, and more.

Let me know, and good luck!

Chris Smith

On Thu, Dec 10, 2020 at 4:59 PM Zachi Baharav <zachi at baharav.org> wrote:

> Dear mighty Haskell list,
>
> I am a high-school teacher in the US (California, Palo Alto). We have an
> advanced CS course that students can take after completing the AP-CS-A (in
> Java). This is usually Juniors and Seniors, after at least 2 or 3 courses
> of coding (Python+Java). Traditionally, I've done a potpourri of subjects,
> mostly search algorithms as applied to 'games'. Of course a little bit of
> data-structure comes in, and each year we did some 'other' interesting
> subject (like halftoning, barcodes, and so on) and investigated and
> implemented algorithms there.
>
> THIS year, for the second half, I would like us to do
> Functional-Programming. From what I have seen, my students over the years
> tend to write more and more convoluted codes, electing first to search on
> stackOverFlow for some similar pattern, rather than think and find a
> concise and clean solution. I think FP would supply them with a new way of
> thinking, which will help with whatever they will write later on.
>
> I've been coding with Haskell for about 7 years, so feel ok leading the
> class.
>
> The question: I have many books on Haskell (i think 'all', but who knows.
> Haskell, Real world Haskell, Learn you a haskell for great good,
> programming in haskell, and many more).
> --->  I am looking for something more hands-on and 'fun' for HS students.
> may i say the buzzword 'project based', or maybe better 'problem based' for
> our case.
> Something that I could teach a little, and then we can solve a bunch of
> problems, and teach a little more, and so on.
>
> It doesn't have to be a Book!!  Just an outline of a course someone did
> with associated bunch of problems would be awesome. We have 18 weeks in a
> semester. My thought right now (if I don't find anything) is to relyon
> Euler project early problems. These are often clean and simple in Haskell.
> Or otherwise some CSES problems (which we've done in Java).
>
> Ok, long enough email.
>
> If you have material and can share here, great!
> If you have material and want to reach out privately, please do (
> zbaharav at kehillah.org).
> If you have a good pointer, that would be appreciated.
>
> Thanks in advance for any help!
>    Zachi
> (Dr. Zachi Baharav, HS teacher  (after 20 years in Industry and academia))
>
>
>
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20201211/328adb69/attachment.html>


More information about the Haskell-Cafe mailing list