[Haskell] Re: Newbie: what are the advantages of Haskell?
tmorris at tmorris.net
Fri Apr 27 16:39:06 EDT 2007
mike clemow wrote:
> As a Java chimp embarking on the Haskell journey myself, I'd be
> interested in hearing about specific ways that learning Haskell has
> changed the way you program Java. How do you employ the "very
> interesting concepts" that you have learned through your study of
> Haskell in your Java programming? Do you employ them at all? _Can_
> they be employed in Java? Has it made you a better Java programmer?
I reinvented functional programming when I was using Java rather than
Haskell making me use Java more succintly. I knew something was
seriously wrong with imperative programming and Java's type system all
those years I spent working on the implementation for IBM. I was pleased
to learn that Haskell incorporated many of my ideas (and more) -
validating my original suspicions. The fact that many of the concepts in
Haskell I had already "invented" made the language easy for me to learn
(as in, "oh yeah of course that makes perfect sense" in response to
I produced many Java projects in an attempt to demonstrate what I
thought was wrong, but few of them remain due to loss of interest.
In regard to the original question, 'What are the mysterious "side
effects" which are avoided by using Haskell, which everyone talks about?
Null pointers?', my response is "yes".
Looking at a NullPointerException (NPE), these exist because of the
imperative nature of the code; with explicit order of evaluation and
potential side-effects. In an attempt to highlight the absurdity of the
fact that a NPE even exists, I like to tell people that "NPEs occur when
you write a program that says, 'give me the something that is not there
yet'". Now, if you have read Stephen Hawking's Brief History of Time and
the chapter titled, Arrow of Time, you will know that "the arrow of time
will not reverse". How absurd it is to suggest otherwise by imperative
programmers! Simply, a programming language that allows an expression of
"give me the non-existent something" contains a logical absurdity.
let p(something) = something exists
let q(something) = something is non-existent
let r = p ? ¬q
let s = p ? q
but r ? ¬s !!
I have long considered (well before I knew about Haskell) formulating a
more concrete proof that imperative programming contains many logical
Remember, forall software. software is based on the lambda calculus. I
believe that you can prove this.
More information about the Haskell