[Haskell] Re: Newbie: what are the advantages of Haskell?

Tony Morris tmorris at tmorris.net
Fri Apr 27 16:39:06 EDT 2007


mike clemow wrote:
> Troy,
> 
> 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?
> 
> Cheers,
> Mike

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
discover monads).

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.

http://jtiger.org/
http://code.google.com/p/pure-functional-java/

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
therefore r
therefore s
but r ? ¬s !!

I have long considered (well before I knew about Haskell) formulating a
more concrete proof that imperative programming contains many logical
absurdities.

Remember, forall software. software is based on the lambda calculus. I
believe that you can prove this.

Tony Morris
http://tmorris.net/




More information about the Haskell mailing list