[Haskell-cafe] FW: Haskell

Tomas Andersson toman144 at student.liu.se
Tue Apr 1 08:03:27 EDT 2008


On Tuesday 01 April 2008 12.18.25 Simon Peyton-Jones wrote:

> How can one answer the question--why choose Haskell over Scheme?
>
> Regards,
>
> Douglas
>

For me, who is still a Haskell newbie, the following are the main reasons why 
I fell in love with Haskell and prefer it over Scheme/Common Lisp today.

1) Pattern matching
Being able to type for example:
fact 0 = 1
fact n = n * (fact (n - 1))

instead of having to write the conditionals and if/case statements every time 
I write a function is amazing. It makes simple funtctions _much_ shorter, 
easier to understand and faster to write

2) Static typing
 Having static typing eliminates tons of bugs at compile time that wouldn't 
show up until runtime in a dynamic language and does it while giving very 
clear error messages.
 And most of the time I don't even have to do anything to get it. The compiler 
figures it out all by is self.


3) Prettier syntax
 Yes, S-expressions are conceptually amazing. Code is data is code, macros, 
backquotes and so on. But I've found that most of the code I write doesn't 
need any of that fancy stuff and is both shorter and clearer in Haskell


4) List comprehension
 I fell in love with in in Python and Haskells version is even more 
beautiful/powerful. Being able to write in one line expression that would 
normally require multiple 'map's and 'filters' is something I'll have a hard 
time living without now.

 Later I've found even more reasons to prefer Haskell over Scheme, for example 
monads, classes, speed, parallellism, laziness, arrows and Parsec but the 
list above are the first things that caught my eye and made me switch.

/Tomas Andersson



More information about the Haskell-Cafe mailing list