[Haskell-cafe] FW: Haskell
nominolo at googlemail.com
Tue Apr 1 08:02:11 EDT 2008
On 1 apr 2008, at 13.02, Bulat Ziganshin wrote:
> Hello Simon,
> Tuesday, April 1, 2008, 2:18:25 PM, you wrote:
>> How can one answer the question--why choose Haskell over Scheme?
> 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!
> 2. lazy evaluation - reduces complexity of language. in particular,
> all control structures are usual functions while in scheme they are
> 3. great, terse syntax. actually, the best syntax among several
> dozens of languages i know
> 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
3 and 4 are no convincing arguments for a Scheme programmer. Syntax
is subjective and there Scheme implementations that can serialize
entire continuations (closures), which is not possible in Haskell (at
least not without GHC-API).
Static typing, though it might sound constraining at first, can be
liberating! How that? Because it allows you to let the type-checker
work for you! By choosing the right types for your API, you can
enforce invariants. For example you can let the type-checker ensure
that inputs from a web-application are always quoted properly, before
using them as output. A whole class of security problems is taken
care of forever, because the compiler checks them for you.
If you're used to REPL-based programming, it can be a bit annoying
that you can't run non-type-checking code, but you get used to it.
After a while you will miss the safety when you program in Scheme again.
There's more, but I count on others to step in here.
More information about the Haskell-Cafe