[Haskell-cafe] How Albus Dumbledore would sell Haskell
rendel at rbg.informatik.tu-darmstadt.de
Fri Apr 20 11:31:53 EDT 2007
Mirko Rahn wrote:
> More important: Correct me, if I'm wrong, but as far as I understand
> java, it is still impossible in your solution to evaluate the equivalent of
> head $ mirror $ rel [ (i,i) | i <- [0..] ]
> in finite time, that is, your MirrorRel is not lazy in the elements. You
> have to build this also by hand and your code becomes even longer and
> more complex.
Yes, that's true. Java is strict, and each bit of laziness has to be
introduced by hand. Just as Haskell is lazy, and each bit of strictness
has to be introduced by hand. It's not clear for a
non-Haskell-programmer that the haskell aproach is better, and i don't
think that it becomes clear by showing a single program wich uses laziness.
>> (Java developers who don't understand Java's advanced features like
>> generics and anonymous classes may not be able to write or understand
>> the above written Java solution; but do you expect them to understand
> Add 1: This statement contradicts your "easyness" claim!?
I don't think so. I was able to write a short (modulo syntactical
overhad of the Java language) and modular Java solution without
consulting reference manuals, drawing diagrams or something.
> Add 2: In contrast, the Haskell solution does'nt uses "advanced Haskell
> features" (whatever this might be), it consists of 6 lines of plain
> Haskell 98 only.
The Haskell solution has no need for "advanced Haskell features" because
Haskell is an advanced programming language. This can be good (no need
to implement advanced features yourself) or bad (fear of what the
advanced features do with your simple-looking code).
More information about the Haskell-Cafe