[Haskell-cafe] Why Haskell is beautiful to the novice

Romain Gehrig romain.gehrig at gmail.com
Fri Aug 28 11:26:35 UTC 2015

To add to Nicola's mail, I think what would be cool is to provide the
"complex" parts to students, ie: IO handling, complex structure
manipulation,... well, all that is not the focus of the current lesson nor
a thing they learned in a previous course. For example, you can provide
this kind of program:

isSquare :: Int -> Bool
isSquare n = undefined

-- Don't touch for the moment
main :: IO ()
main = do
  putStrLn "Square checker: check that an integer is the square of another
  putStrLn "Input the integer to check: "
  input <- getLine
  let number = (read input :: Int)
  if (isSquare number)
      then putStrLn (show number ++ " is a square!")
      else putStrLn (show number ++ " is not a square!")

(Maybe isSquare is not the best function for a student to create for a
first time, but you get the idea)

What can be a good idea is to make the students create their own set of
functions as exercise and then create a bigger project reusing these. I can
remember my own programming course where the code I created was then
ditched for the reason it was only for an exercise. It was a bit

My whole point is: show your students the immense reusability of Haskell
code and the enjoyment of its composability.

-- Romain

2015-08-28 12:12 GMT+02:00 Nicola Gigante <nicola.gigante at gmail.com>:

> > 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.
> Go ahead!
> > — Olaf
> Greetings,
> Nicola
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150828/48c9e9c3/attachment-0001.html>

More information about the Haskell-Cafe mailing list