But first things first. Let me tell you why I decided to learn Haskell.
1st Haskell is purely functional, variables could get assigned once only, so I wanted to know how the hell they deal with keeping state.
2nd Few lispers like Slava and Frank knew Haskell.
3rd Haskells' code is very compact.
So I grabbed Winhugs and went Huskying. I quickly went through YAHT but I was really disappointed. That made me into writing that lengthy Haskell sucks rant, but after little thinking I understood that I was learning Haskell the lispy style, read Gung-Ho. Damn,I was practically trying to write lisp in Haskell and whenever Haskell complained I was furious. So I decided to give it another shot, this time with Haskell The Craft of functional programming. Halfway through the book I decided to clean my mind of my current thoughts about Haskell by writing this article.
So it presents current state of my mind. Keep in mind that I'm a multipass doer, it needs several iterations before I make something good. So I'll start with little philosophical view.
Design of Haskell:
There is a nice article called What is a Ryu? that explains the definition between a classical japanese martial art, koryu and modern ones like judo. I found it very enlighting in comparing computer languages. To save your time from reading it I extracted few paragraphs. So what's difference between ryu, classical martial art and do, modern ones.
The word ryu roughly translates to style or school but the real meaning is "to flow, flowing... system or school," and here's how Wayne explains how the ryu is created.:
The founder of the style experienced what amounted to a divine revelation. These experts had already developed a vast repertoire of technical knowledge through a study of martial methods and through actual experience in battle and/or in training. But having exhausted and reached the limits of their technical expertise, they consciously underwent shugyo, or a rigorous training that tested their mind, body and spirit.
Often enacted in the confines of sacred ground such as a Shinto shrine or Buddhist temple, or in a hidden religious refuge in the wilderness or mountaintop, shugyo was meant to crack through the surface layer of the physical world to lay bare the secrets of the spiritual universe. Like the intensity of Zen training, after exhausting the everyday avenues of awareness, the trainee undergoing martial arts shugyo attains a new and enlightening insight.
After this period of intense training, prayer, and some kind of fasting and/or abstention, a vision would appear to the founder, that would give him the key to true mastery of his art. Often just a simple phrase or very rudimentary technique(s), the revelation would be the key that unlocked all the subsequent methods that the founder would develop. As such, the revelation was tenshin shoden, or knowledge bestowed from the Heavens, or muso; knowledge gained from a heavenly dream.
The knowledge, therefore, was heavenly pure when it was first passed from the gods to the first generation. If it is to remain a divinely inspired system, then it must always flow back to this person, the founder. Hence, the term -ryu, or nagare; it is a flow back to the wellsprings of the style, which was divine inspiration.Now let's compare ryu with do, meaning the way. the modern craft.
Judo, as a do form (a "modern" type of martial art stressing mind, body and spiritual development over self-defense or combative methods), is just judo, period. You may have a Kodokan style of judo, a Japanese college style, an Olympic style, but because it is so all-encompassing, there are no ryu in judo. Judo is so malleable in techniques, and is so reasonable in its scientific application of contest-oriented grappling methods that it continues to grow and innovate in technical complexity. It is in fact difficult to truly innovate and create something completely "new" under the sun. Most of us martial artists in this day and age simply aren't capable of such stunning originality.
In case you skipped Muromoto description , ryu is something created with divine inspiration, deity called Alonso Church visited John McCarthy and he combined that vision with s-expressions and made something original, something beautiful.
The first lisp. Common lisp, scheme and emacs lisp are just ryuha (factions ) within a lisp ryu. They're part of the lisp flow but they ain't so pure like the founders original idea. That's why Paul Graham tries to get back to the roots of the original lisp with his Arc. Will he succeed that's another question.
From the other side we have do, 'modern' martial arts they "were developed by committees of human beings, whose attempts are in synch with the modernist trend that things can always be improved with time and human ingenuity.". Most of the modern languages are like do martial arts. Those are languages that weren't blessed with heavenly inspiration. It isn't that their authors wasn't smart or they weren't great programmers, quite the contrary, it's just that muse of inspiration didn't visit their door when they were designing their language. So they did what they did with what they had.
Haskell is one of those 'unblessed ', modern do languages sharing company with c++, java, c#, OCaml, F# etc. If you compare Haskell with some ryu language like Prolog, also one I recently started learning, the difference is obvious. When I tried Prolog I said 'Wow', all the language could be made just from rules ( facts are just degenerated form of rules). On the other side we have Haskell with their bulky kernel language and complex rules of composition. Haskell designers took features from older languages Lisp and Prolog and mixed them together with their own ideas. That's nothing wrong with it, humans build on existing foundations. The problem is that they failed to unify those techniques, so instead of making a monolith tool they ended with "a mess of illogical patchwork". It's not that result is unusable, quite the contrary, but it's not a masterpiece either.
After this philosophical introduction let's get little practical. How does programmming Haskell feels.(This list will probably get changed as I'm learning more of the language)
The good :
1. It teaches you a lot about functional programming. Lisp encourages functional programming , but Haskell enforces it. So all your nasty habits you picked up coming from imperative and object oriented languages will have to go away. There is no looping and variables could be assigned only once. Most of the Haskell constructs for functional programming are already in lisp, but lisp allows you to write imperative and OO code if you want. That won' t do in Haskell. Remember about the composing functions , and returning functions as values. Well I didn't used them much in my lisping. Haskell taught me about their value.
2. You got compact code for free. As soon as your c program is working its probably fast. The same goes with Haskell, as soon as your code is working it's short. With lisp you usually have to work to make your code with c-s' speed or haskells' size.
3. You'll learn a lot of functional constructs, that could find a good use in your lisp arsenal, point free programming, curry, uncurry, flip etc.
4. You'll understand the value of laziness and generators. There's a cool library called heresy made by Matthew Lamari. And you might befriend with your old but long forgotten acquaintance series
5. Built in pattern matching - it's very convenient about programming sometimes. Unfortunately for someone who learned Prolog before Haskell, Haskells' pattern matching will look very limited.First it doesn't allows me to repeat a variable in a pattern , second compared with Prolog, it's one sided. Big issue for someone used to full power of unification.
6. Algebraic data types are neat.
1. Static typing sucks. It reminds me of the dark ages of programming in the c family of languages. Inference engine saves me from writing the boring type declarations but it's far from perfect. I have nothing against static typing if it's optional. One of the coolest features of lisp that I found when I started learning it coming from c++ was thatI could put anything into lisp containers. And I don't want going back.
2. No rapid development. Don't get me wrong, developing in Haskell is faster than in c++ or c# but compared with ultimate RAD vehicles like lisp or prolog, haskell looks like a family caravan against full blood racers. Haskell doesn't allows me to experiment. It doesn't allows me to create modulus with some functions undefined or defined wrong. Bundle this together with loading file to redefine a module, the cruppiest feature they took from Prolog and you'll start to value your lisp listeners.
3. Hogs a lot of brain resources. It's syntax is complex, and together with static typing it forces me to spend more resources on dealing with language than with dealing with the problem.
4. Inflexible- Remember the Alan Kay quote - Lisp isn't a language it's a building material. Not so with Haskell. You can not wrap the Haskell around the problem as you can do with Lisp. Haskell forces you to work the other way around.
5. Spartan development enviroment. Compared with lisp offerings WinHugs looks poor man's IDE. There are so much things that are missing that I don't know where to start. Beside I had to write Haskell code in notepad, best editor available under windows, after Crimson failing to start after I switched to Haskell mode. And don't even dare to mention Emacs, a lot of people don't like it.It's 2008 and creating a simple Haskell editor is not an rocket science. I need an integrated editor with syntax coloring and intellisense kind of reminding me how many and what type of arguments function takes. That's it. Another option is Visual Haskell, used as editor togather with winhugs, for interactivity. Also there is no debugger, so forgeth about stepping, functional style of Haskell, helps here but it's just a hassle debugging by hand.
Greg Buchholz adviced about GHCi debugger so I will check on it and advice later.Personally I would be happier with something for hugs.
6. Lacks reflexive abilities. Oh silly me of course it lack them. In Haskell everything is carved in stone. Programming in Haskell is like proving a mathematical theorem. There is no screwing around. It's like life in a monastery, full of fasting, preying and compassion under the all seeing eye of the abbot, punishing you for every mistake. So if this kind of life is for you, you'll end up in heaven, but if you want playing around and can't (don't) want life without women, parties, drinking and good food than Haskell is definately wrong choice.
7 and 8 are probably more personal than the others. But this whole post is personal. :)
7. Case sensitive - why does types has to start with uppercase and functions with lowercase. To make it easier for the implementation writers? Or to enhance readibilty. The latter has other way to be achieved. Any syntax coloring editor is smart enough to gave you visual clues what the hell some name means.
8. Indentation matters.