[Haskell-cafe] FW: Haskell

Andrew Bagdanov bagdanov at gmail.com
Tue Apr 1 10:42:50 EDT 2008

On Tue, Apr 1, 2008 at 1:02 PM, Bulat Ziganshin
<bulat.ziganshin at gmail.com> wrote:
> Hello Simon,
>  Tuesday, April 1, 2008, 2:18:25 PM, you wrote:
>  > How can one answer the question--why choose Haskell over Scheme?

Well as a longtime Scheme and OCaml programmer, and Haskell-cafe
lurker, I'll take a stab at this...

>  1. static typing with type inference - imho, must-be for production
>  code development. as many haskellers said, once compiler accept your
>  program, you may be 95% sure that it contains no bugs. just try it!

I think this is the biggest, and most obvious, difference to consider
when choosing either Scheme or Haskell over the other -- for a
particular problem.  Dynamic and static typing each have their
advantages, depending on the context.  I think it's dangerous to try
to answer the question "Scheme or Haskell?" without a problem context.

>  2. lazy evaluation - reduces complexity of language. in particular,
>  all control structures are usual functions while in scheme they are
>  macros

Well, if I don't have side effects (and don't mind extra, unneeded
evaluations), I can write my conditionals as functions in Scheme too.
Heck, now that I think of it I can even avoid those extra evaluations
and side-effect woes if i require promises for each branch of the
conditional.  No macros required...

I think some problems are just more naturally modeled with lazy
thinking, and a language with implicit support for lazy evaluation is
a _huge_ win then.  I written plenty of lazy Scheme, and OCaml for
that matter, code where I wished and wished that it just supported
lazy evaluation semantics by default.  Again, I think this is highly
problem dependent, though I think you win more with lazy evaluation in
the long run.  Do more experienced Haskellers than me have the
opposite experience?  I mean, do you ever find yourself forcing strict
evaluation so frequently that you just wish you could switch on strict
evaluation as a default for a while?

>  3. great, terse syntax. actually, the best syntax among several
>  dozens of languages i know

I think this is possibly the weakest reason to choose Haskell over
Scheme.  Lispers like the regularity of the syntax of S-expressions,
the fact that there is just one syntactic form to learn, understand,
teach, and use.  For myself, I find them to be exactly the right
balance between terseness and expressiveness.  For me, Haskell syntax
can be a bit impenetrable at times unless I squint (and remember I'm
also an OCaml programmer).  Once you "get it," though, I agree that
the brevity and expressiveness of Haskell is really beautiful.

>  4. type classes machinery, together with type inference, means that
>  code for dealing with complex data types (say, serialization) is
>  generated on the fly and compiled right down to machine code

This is obviously related to #1, and Haskell sure does provide a lot
of fancy, useful machinery for manipulating types -- machinery whose
functionality is tedious at best to mimic in Scheme, when even

In short, I think the orginal question must be asked in context.  For
some problems, types are just a natural way to start thinking about
them.  For others dynamic typing, with _judicious_ use of macros to
model key aspects, is the most natural approach.  For the problems
that straddle the fence, I usually pick the language I am most
familiar with (Scheme) if there are any time constraints on solving
it, and the language I'm least familiar with (Haskell, right now) if I
have some breathing room and can afford to learn something in the



>  --
>  Best regards,
>   Bulat                            mailto:Bulat.Ziganshin at gmail.com
>  _______________________________________________
>  Haskell-Cafe mailing list
>  Haskell-Cafe at haskell.org
>  http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list