
Although somewhat dated (posted on October 24, 2006 4:39 PM, to be precise), here is an interesting comparison of Haskell and Scheme, by Mark C. Chu-Carroll, a PhD computer scientist who works as a software engineer at Google, on his blog, regarding whether someone should translate Douglas Hofstadter's columns introducing Scheme to replace the Scheme code with Haskell code: Good Math, Bad Math : Haskell and Scheme: Which One and Why? http://scienceblogs.com/goodmath/2006/10/haskell_and_scheme_which_one_a.php The entry discusses differences in syntax, typing, and semantics, and makes for interesting reading. Surprisingly, he states that Haskell syntax is easier to learn for beginners:
I've actually taught an introduction to computer class using Scheme, and the syntax was a big problem.
I think that syntactically, Haskell is a better language for beginners. Haskell syntax is very redundant, which is good for people. Compare these two little snippets:
(define (fact n) (if (= n 0) 1 (* n (fact (- n 1)))))
fact n = if n == 0 then 1 else n * fact(n-1)
Which is easier to read? And the Haskell can get even easier to read and write using pattern matching:
fact 0 = 1 fact n = n * fact (n-1)
Try this comparison:
(define (fold init reducer list) (if (eq? list ()) init (reducer (car list) (fold init reducer (cdr list)))))
versus:
fold init reducer [] = init fold init reducer l:ls = reducer l (fold init reducer ls)
The difference gets much more obvious with bigger pieces of code. Between the deliberate redundancies in Haskell's syntax, and the way that pattern matching lets you decompose programs, the Haskell is significantly clearer.
This is the first time that I have seen a claim that Scheme syntax was a big problem compared to Haskell syntax, but his claims make sense. It makes me wonder whether his students were true beginners.... If his claims are true, though, then we probably need a counterpart to SICP (see http://mitpress.mit.edu/sicp/) for Haskell. The closest I can think of is SOE (see http://www.haskell.org/soe/); any alternatives? There's also _The Haskell Road to Logic, Maths and Programming_ (see http://homepages.cwi.nl/~jve/HR/) and _Real World Haskell_ (see http://book.realworldhaskell.org/), but the former is really about using Haskell to learn discrete mathematics and logic, and the latter is not directed toward computer science majors, so they don't correspond very closely. If Haskell is well-suited as a language for beginners, then there shouldn't be any reason for not creating a Haskell alternative. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^

Benjamin L.Russell
Although somewhat dated (posted on October 24, 2006 4:39 PM, to be precise), here is an interesting comparison of Haskell and Scheme, by Mark C. Chu-Carroll, a PhD computer scientist who works as a software engineer at Google, on his blog, regarding whether someone should translate Douglas Hofstadter's columns introducing Scheme to replace the Scheme code with Haskell code:
Good Math, Bad Math : Haskell and Scheme: Which One and Why? http://scienceblogs.com/goodmath/2006/10/haskell_and_scheme_which_one_a.php
The entry discusses differences in syntax, typing, and semantics, and makes for interesting reading.
I've got a question related to comparison of Haskell and Lisp. I just learned some basics about category theory and therefore started to learn some Haskell, too. Currently I'm doing most of my hacking in lisp (to be precise: the probably unpurest language out there, Common Lisp), so please excuse my ignorance as I'm try to change this. Of what I've seen so far, I'm very fascinated by the power and elegance of Haskell. I read a few short introductions on Monads, getting a glimps of easy DSL developing in Haskell. In Lisp, one would use the macro system to achive this. Even though the concepts seem fundamentally different, I was wondering if there are any parallels? Also, could someone point me to a gentle introduction to syntax, semantics and type systems? I understand that lisp-like macros do not exist in Haskell since they would break the type system and could give rise to unclear semantics. I'd like to understand what's going on, so pointers to books or tutorials would be highly appreciated. Thanks Albert
Surprisingly, he states that Haskell syntax is easier to learn for beginners:
I've actually taught an introduction to computer class using Scheme, and the syntax was a big problem.
I think that syntactically, Haskell is a better language for beginners. Haskell syntax is very redundant, which is good for people. Compare these two little snippets:
(define (fact n) (if (= n 0) 1 (* n (fact (- n 1)))))
fact n = if n == 0 then 1 else n * fact(n-1)
Which is easier to read? And the Haskell can get even easier to read and write using pattern matching:
fact 0 = 1 fact n = n * fact (n-1)
Try this comparison:
(define (fold init reducer list) (if (eq? list ()) init (reducer (car list) (fold init reducer (cdr list)))))
versus:
fold init reducer [] = init fold init reducer l:ls = reducer l (fold init reducer ls)
The difference gets much more obvious with bigger pieces of code. Between the deliberate redundancies in Haskell's syntax, and the way that pattern matching lets you decompose programs, the Haskell is significantly clearer.
This is the first time that I have seen a claim that Scheme syntax was a big problem compared to Haskell syntax, but his claims make sense. It makes me wonder whether his students were true beginners....
If his claims are true, though, then we probably need a counterpart to SICP (see http://mitpress.mit.edu/sicp/) for Haskell. The closest I can think of is SOE (see http://www.haskell.org/soe/); any alternatives? There's also _The Haskell Road to Logic, Maths and Programming_ (see http://homepages.cwi.nl/~jve/HR/) and _Real World Haskell_ (see http://book.realworldhaskell.org/), but the former is really about using Haskell to learn discrete mathematics and logic, and the latter is not directed toward computer science majors, so they don't correspond very closely. If Haskell is well-suited as a language for beginners, then there shouldn't be any reason for not creating a Haskell alternative.
-- Benjamin L. Russell

On Tue, 10 Feb 2009 00:30:40 -0800, Albert Krewinkel
Of what I've seen so far, I'm very fascinated by the power and elegance of Haskell. I read a few short introductions on Monads, getting a glimps of easy DSL developing in Haskell. In Lisp, one would use the macro system to achive this. Even though the concepts seem fundamentally different, I was wondering if there are any parallels?
Lisp-style macros enable one to extend Lisp syntax. They take Lisp code as input, and return Lisp code as output. This behavior is closely related to reflection (see http://en.wikipedia.org/wiki/Reflection_(computer_science)), in which a computer program observes and modifies its own structure and behavior. In a related thread on Haskell-Cafe (see "[Haskell-cafe] Re: Monad explanation" at http://www.haskell.org/pipermail/haskell-cafe/2009-February/055052.html), I recently asked about reflection in Haskell:
On Wed, 4 Feb 2009 21:43:04 -0800, Max Rabkin
wrote: On Wed, Feb 4, 2009 at 9:38 PM, Benjamin L. Russell <DekuDekuplex at yahoo.com> wrote:
Is it possible to write a self-referential function in Haskell that modifies itself?
Is it possible to write *any* kind of function in Haskell that modifies *anything*?
While trying to research this issue, I came across a relevant archived thread in Haskell-Cafe, entitled "[Haskell-cafe] haskell and reflection," started by Greg Meredith, dated "Tue, 11 Sep 2007 07:09:22 -0700" (see http://www.mail-archive.com/haskell-cafe@haskell.org/msg29882.html), which at first had me worried. Specifically, Greg wrote as follows:
Am i wrong in my assessment that the vast majority of reflective machinery is missing from Haskell? Specifically,
- there is no runtime representation of type available for programmatic representation - there is no runtime representation of the type-inferencing or checking machinery - there is no runtime representation of the evaluation machinery - there is no runtime representation of the lexical or parsing machinery
In fact, Haskell does offer a somewhat similar parallel to macros in Lisp: Template Haskell (see http://www.haskell.org/haskellwiki/Template_Haskell). To continue:
Op 11-sep-2007, om 18:43 heeft Greg Meredith het volgende geschreven:
[...]
Template Haskell [1] is a system that lets you write programs that get executed at *compile time*, and that produce parts of the Haskell program to be compiled by manipulating a representation of the program as structured data. It's a form of reflection restricted to compile time, if you'd ask me.
[...]
According to the site referenced by the above-mentioned link,
Template Haskell is an extension to Haskell 98 that allows you to do type-safe compile-time meta-programming, with Haskell both as the manipulating language and the language being manipulated.
There is also a related thread on this issue: Explanation of macros; Haskell macros http://mail.python.org/pipermail/python-list/2003-October/228339.html The above-referenced paper also references the following related paper discussing this topic in more detail: Template Meta-programming for Haskell by Tim Sheard and Simon Peyton Jones http://www.haskell.org/th/papers/meta-haskell.ps
Also, could someone point me to a gentle introduction to syntax, semantics and type systems? I understand that lisp-like macros do not exist in Haskell since they would break the type system and could give rise to unclear semantics. I'd like to understand what's going on, so pointers to books or tutorials would be highly appreciated.
One book that is often mentioned in this context is the following: Types and Programming Languages by Benjamin C. Pierce http://www.cis.upenn.edu/~bcpierce/tapl/ Hope this helps.... -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^

On Tue, 10 Feb 2009 19:03:31 +0900, Benjamin L.Russell
There is also a related thread on this issue:
Explanation of macros; Haskell macros http://mail.python.org/pipermail/python-list/2003-October/228339.html
The above-referenced paper also references the following related paper discussing this topic in more detail:
Template Meta-programming for Haskell by Tim Sheard and Simon Peyton Jones http://www.haskell.org/th/papers/meta-haskell.ps
Correction: Please substitute "thread" for "paper" in the above-quoted sentence starting with "The above-referenced paper...." Apologies. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^

Benjamin L.Russell
On Tue, 10 Feb 2009 19:03:31 +0900, Benjamin L.Russell
wrote: There is also a related thread on this issue:
Explanation of macros; Haskell macros http://mail.python.org/pipermail/python-list/2003-October/228339.html
The above-referenced paper also references the following related paper discussing this topic in more detail:
Template Meta-programming for Haskell by Tim Sheard and Simon Peyton Jones http://www.haskell.org/th/papers/meta-haskell.ps
Correction: Please substitute "thread" for "paper" in the above-quoted sentence starting with "The above-referenced paper...."
Apologies.
-- Benjamin L. Russell
Those are great resources! Thanks a lot! Albert

On Tue, Feb 10, 2009 at 5:18 AM, Benjamin L. Russell
Although somewhat dated (posted on October 24, 2006 4:39 PM, to be precise), here is an interesting comparison of Haskell and Scheme, by Mark C. Chu-Carroll, a PhD computer scientist who works as a software engineer at Google, on his blog, regarding whether someone should translate Douglas Hofstadter's columns introducing Scheme to replace the Scheme code with Haskell code:
He forgot to tell that Haskell is the best imperative language :).
The entry discusses differences in syntax, typing, and semantics, and makes for interesting reading. Surprisingly, he states that Haskell syntax is easier to learn for beginners:
I don't think that's surprising at all. Haskell's syntax is one of the bests I've ever used: clean, simple, and yet powerful. -- Felipe.
participants (3)
-
Albert Krewinkel
-
Benjamin L.Russell
-
Felipe Lessa