On 08/24/2011 08:19 PM, Jonathan M Davis wrote:
On Wednesday, August 24, 2011 04:22 bearophile wrote:
Caligo:
Haskell is one of the most beautiful languages. I wish I had discovered
it sooner.

I am now able to write small Haskell programs. It has some features and
parts that I like significantly (and I'd like some of them in D too!), but
so far I am not appreciating it much on the whole. It feels almost like a
"puzzle language", as Forth (almost, but not really). Those operators are
not easy to find in the documentation, the purpose of all those little
functions is not easy to remember, and its obsession with purity sometimes
turns easy things into very complex things (I like purity and
immutability, but not much inside functions, so I prefer D). It's good for
some kinds of tasks (Euler Puzzles, certain math tasks, certain
experiments about types), acceptable for other tasks (some generic
algorithms, some string processing, etc), and bad for many other purposes,
so it doesn't feel like a general purpose language. I am sometimes able to
write very short programs with it, but often they are slow. It's not easy
for me to tell how much efficient a program will be, onc! e compiled with
GHC. Keep in mind that I am a newbie of Haskell, so don't take my comments
too much seriously :-)

I like Haskell and have used it a fair bit, but I don't use it a lot these
days. I think that every serious programmer should study and learn at least
one functional language. Learning to think functionally can have be very
helpful even in imperative programming and will make you a better programmer.
And on top of the kind of stuff that it normally helps with (like
understanding recursion), in D it helps when dealing with ranges, since ranges
can be processed like slists a lot of the time.

However, as much as I like Haskell, I find it very hard to work with on
anything large, and even smaller stuff can be difficult. It just requires too
much brain-bending to figure out how to do something purely functionally for
it to be easy, and Haskell's laziness makes debugging it very difficult.

So, I definitely recommend learning a functional lanugage (and Haskell is a
good one), but I wouldn't program in it as my primary language. The main
reason that I've used it as much as I have is that it has a fantastic parsing
library (Parsec). And actually, I've been working on trying to port it to D,
though it'll probably be a while before I finish it, and the lack of laziness
could actually be a performance impediment in this case, since you risk having
to copy the parsing state too often. Hopefully I can get that sorted out
though. I still have a ways to go with it regardless.

- Jonathan M Davis

I have implemented runtime lazy lists on top of delegates as a toy project. I have also written some utility lazy functions, a purely functional lazy merge sort to sort the lists and a recursively defined fibonacci list that works in O(n). Unfortunately it is about 10 times slower than haskell. :)

And the syntax sucks, much owed to
http://d.puremagic.com/issues/show_bug.cgi?id=6260

If anyone is interested:

http://pastebin.com/2rEdx0RD

Reply via email to