[Haskell-cafe] Why Haskell is beautiful to the novice
nicola.gigante at gmail.com
Fri Aug 28 10:12:45 UTC 2015
> Il giorno 27/ago/2015, alle ore 23:08, Olaf Klinke <olf at aatal-apotheke.de> ha scritto:
> Dear cafe,
> please correct me if questions like this should not go via this mailing list.
> Presumably everyone on this list agrees that Haskell stands out as a beautiful and pleasant language to have. The recent nitpicking and real-world problems like cabal hell don't change that. However, statements supporting Haskell's beauty usually involve: "In Haskell it is so much clearer/easier/faster to ... than in another language." That is, the beauty of Haskell presents itself to those who can compare it to other imperative or not strongly typed languages that one learned before Haskell.
> My question is, for what reason should anyone not acquainted with any programming language find Haskell beautiful? Maybe it does not look beautiful at all to the novice. The novice can not draw on the comparison, unless he takes the effort to learn more than one language in parallel. The novice likely also does not have the mathematical background to see the beautiful correspondence between the language and its semantics. (My reason to love FP is because it is executable domain theory.) One might argue that it is not the language itself that is beautiful, but rather the concepts (data structures, algorithms, recursion) and Haskell does a great job to preserve their beauty into the implementation. Do you agree?
> Disclaimer: I am about to start teaching a first course in computer science in secondary school. I can teach whatever I want, since this is the first CS course the school ever had. I want to teach beautiful things. I love functional programming. I need not start teaching programming right away. But I am reluctant to expose the pupils to something whose beauty escapes them completely.
In my opinion, the first CS course in school (and to some extent
the math and physics courses as well) should aim, more than teaching specific
skills or knowledge, to transmit to student the beauty of programming _itself_
(respectively math and physics).
The student should be able to perceive the feelings of wonder and enlightenment
that rise from solving a challenging problem, or to understand some
previously obscure phenomenon, by applying math and reasoning.
This objective is well suited for a CS course because students can also
be initially motivated by the promise of learning something really useful.
Haskell is particularly well suited for this task, not because the student would
necessarily be able to perceive the beauty of Haskell itself, but because
Haskell does not obscure, and in some ways enhance, the beauty of
programming as a whole. In contrast, when first CS courses start with
convoluted or low level languages such as C or Java, students loose
the point of everything, overwhelmed by pointers, useless OOP,
obscure syntax, low-level technical details. Wonder and enlightenment
become pain and frustration.
Btw, if you want to _also_ teach computer architecture in addition to
programming, I think that is best suited to a different part of the course
and does not need to be interleaved with learning programming, so
I wouldn’t bother with C and the like. Or better, you can explain C
as a tool to better understand computers and operating systems, but
after they’ve learnt how to program, not as a tool to learn programming.
Using Haskell (specifically some kind of concepts, e.g. equational reasoning)
will also make easier for students to see the connection between math
and programming, making them more motivated to learn math as well.
To me, your choice to start the CS course by teaching Haskell is
a wonderful choice and your students will thank you in a few years.
> — Olaf
More information about the Haskell-Cafe