Oh good. The usual mix of trivialities and fallacies one gets when someone starts to get excited about a new language.
Summary version: Haskell supports functional programming, has custom defined operators and I stupidly believed all the people who lied to me about automatic parallelisation of Haskell code.
It's unclear if he means that with par the runtime will work out when and where to run his expressions (in parallel), or whether he's assuming the compiler is inserting par for him.
If then I do something in my function which needs some of those values, Haskell can start computing the ones it needs in parallel, waiting on the completion of the whole set before returning the final result. This is a decision the language itself can make, as a by-product of its design.
I'm wondering if people who write these articles about Haskell actually use it. It seems that most of the time they know Haskell for a few days and think it's cool to crack its code.
I don't think this is a bad thing though -- it starts with recognizing the common and different parts with other programming languages and seeing how much you can do with it even without using it. Shows that picking Haskell up and running away with it doesn't take much.
It does take much to pick up Haskell and run away with it. I've always found programming languages generally pretty easy to learn. And then came Haskell. I recognized a lot of cool things in Haskell but once I actually tried to do anything useful with it, I realized just difficult it was. The learning curve is extremely steep, IMO and you really need to be dedicaded to learning it. It isn't like other languages I've used where I culd just start coding stuff. I spent a couple weeks pouring over over tutorials and I still couldn't put together anything but the most trivial program.
I agree with this, and it's part of the reason I'm starting to think Haskell is just a bunch of hype.
All these articles cover trivial bits of the language, and then throw out that Haskell doesn't allow side effects, that it's completely pure and blah blah blah. But they never seem to mention that those things will make learning Haskell really difficult for 99.99% of programmers. Hell, most of the authors seem to have such a cursory knowledge of the language I doubt they even have any idea.
This could simply mean that the documentation is not as good as it could be. From reading through most all of the tutorials and many of the research papers, I can say that this is the case. It turns out that effectively dealing with the lack of side effects and lack of mutable variables, is something that can not be broken down and explained in simple terms. However, given a more reasonable language that allows side effects and mutable variables, you will still have these complications eventually as your program becomes large, and your ad-hoc and intractible solution will come home to roost. Then we'll see if your OO gods will save you. BUAHAHAHAHAHAHAHAHA!! No.
So more reasonable languages than Haskell (eg. OCaml, F#), although easier to program for small/mid-size apps, at some point in size, will fail compared to Haskell?
Not necessarily fail outright completely, but certainly reach the point of consuming exponentially more maintenance time and resources at a certain scale. One starts assuming software organization around even limited state changes, and soon it becomes more and more out of necessity, to the point where reighning in state and effects requires more discipline and attention that if one had planned with a no-state-change policy to begin with.
Two things on my mind:
I think 98% of us (including myself) grossly underestimate how quickly allowing state changes can lead to crippling complications in managing a program. A highly-talented programmer may be able to 'scale up' much more than average, but this is about as good as it gets, in reality.
The size at which a software project allowing state change succumbs to these crippling complications is very unpredictable. Certain approaches are used to mitigate this somewhat, ranging from little effect (OOP), to more effective (functional style), but the result is still what can be seen as unpredictable.
Yeah, that's actually the book I used to learn Haskell after seeing all the recent hype. It has a few faults, but it's a lot better than anything around the last time I tried to learn Haskell a few years ago.
In any case, in my other comment I was specifically refering to articles and blog entries on the internet cheer leading for Haskell.
There's been an awful lot of them posted to the programming reddit, and I don't recall any of them mentioning the larger than normal learning curve.
It's not the language itself that's the "problem" - it's the required shift in the way you think about things.
"There are only two kinds of languages: the ones people complain about and the ones nobody uses."
I've yet to find any real piece of usable, viable, helpful or efficient utility or software written in Haskell that changed the face of programming as we know it.
Haskell is purely academic. Even Y-Combinator wrote their newsletter in Lisp. I've looked at Haskell's web related libraries and sort of chuckled to myself; it was like listening to the most pretentious of experimental bands play a wall of sound for five hours. There's always one guy who's says, "Genius, man..."
Actually, he's a major figure in the haskell community, has authored the most successful Haskell book out there (that may not be saying much on its own, but it was also one of the top general programming sellers on Amazon for a while), and has made countless interesting new contributions to the general state of haskellness. That and he keeps the Haskell subreddit stocked with interesting reading material :)
He called you a jerk for making an unfounded, sweeping statement about something you clearly don't know much about. That and a meaningless statement about it not being groundbreaking (personally, I think it will be the only good way to program massively parallel programs, but who am I to know). There's no need to get all childish and vulgar over that. Just substantiate your claim and you might get a more respectful answer.
dons is a haskell publicist. There is nothing else to him--to it. If you regard it as a little white 'o' in nethack, you will A) actually be better-equipped to predict its behavior on reddit, and B) keep your scorn in check. Who gets angry at a used-car salesman? Who expects sincere language from a politician's PR monkey? o's comment was not even directed at you.
I guess if you call making good libraries, programs and techniques (stream fusion?) "publicizing the language", because more people will want to use it, then you have a point: http://code.haskell.org/~dons/code/
You might want a different tutorial, emphasising integration and the complete development process, not bits and pieces of fun stuff.
RWH is certainly in this camp, and is online, and explicitly is based on building real systems e.g. servers, apps, network code, from start to end. That might fill in the missing glue you'd not identified.
I don't have on hand other tutorials that fit that model, but there are particular bloggers who try to put the end-to-end story together as well (e.g. augustuss, bos).
The lack of tutorials giving an integrated, whole world picture of software engineering in Haskell has been a problem in the past. We seem to be moving past that now, though, I hope.
You're book is really well written, and I thank you for it (I did purchase a copy).
I believe you should disclose you are the author, because it does bias you. Also It would be really great if you'd go over the newer comments people have been filling in in the online version. I know there is limited time for this, but it sometimes does feel like commenting into a void.
Yep, that's me (this is programming reddit, I live here :)
Yes, we've already integrated most of the comments. The 2nd edition should be out soon, with all those things encorporated. Thanks for the contributions.
I think it may be due to your background. I think if you come from an imperative environment and you're used to doing things by manipulating the state, Haskell is indeed very hard to use.
Haskell was the first functional language I've put serious time into learning and I found that once I got past the fact that it does not work the same as imperative languages it was actually a very clean and pleasant language to work in.
After spending a bit of time in it, I found it to be just as easy as any other language. I do not believe there is anything fundamentally more challenging about functional programming. It's like saying that Chinese is harder to learn than French. It purely depends on what languages you already know.
If you're interested how Haskell is applicable to real problems I recommend checking out the Real World Haskell book http://book.realworldhaskell.org/ it covers a lot of common topics, and is rather well written.
I use Haskell, and have been for the past 2 months. I was initially drawn to it because its a relatively portable (Windows/Mac/Linux/BSD) high level language with good performance.
I came to love it because it had clean syntax and semantics, and defined a world view. I think LISP is overly flexible--it allows for OO, functional programming, and anything else. The lack of focus (and the constant nesting of parenthsis) turns me off.
If you want to needle me about these being crappy reasons to start using and advocating a language, I'll totally agree with you. It is crappy, but typically you learn languages on whims or because you're forced to by school or work. Then later, you'll be able to choose the right language for the job.
However, if all you know is C/C++ then you wouldn't choose Haskell even if it were the best tool for the job simply because you weren't familiar with it.
Interviewer: "So, Common Lisp, what would you say your greatest weakness is?"
Common Lisp: "Well, I'm probably overly flexible. I have good support for procedural, functional, and object-orient programming, among other styles, and it's easy to extend me for other styles as they come along."
Lazy languages do require you to take a different approach to understanding your program's performance characteristics, but GHC provides a profiler to do the measurements, and a couple of approaches to the methodology of profiling lazy code are given in "Purely Functional Data Structures," which is a must read, particularly for Haskell folks.
GHC's profiler is great, particularly the way you can annotate arbitrary expressions and say "tell me how long it takes to reduce this." Unfortunately, after you know, fixing it involves a largely experimental process of doing some in-your-head dataflow analysis, then transforming your program, moving constructors around, adding strictness, and sacrificing a chicken.
I can't completely disagree with this, but it doesn't have to be quite so ad hoc if you follow one of the approaches from "Purely Functional Data Structures." Of course, there's a legitimate question as to why you should have to read "Purely Functional Data Structures" in order to learn how to methodically optimize Haskell code...
Well, you can use Lisp without actually designing complex macros. And I'd say that when the only reason for Common Lisp are macros, then there's no reason at all.
I'd like to see a decent introduction to monads. I have googled and googled but I still haven't seen a good, clear introduction. All on the ones I've seen just present examples and you have to sort of figure it out by osmosis.
Is it true that the main advantage of Lisp macros is they they enable skipping parameter evaluation? I thought they went much further, such as enabling new control structures, etc. But maybe the writer is right and all of their advantages boil down to avoiding evaluation. Is he right?
The main advantage of lisp macros is to be able to define code rewrite rules with the full power of lisp, instead of a limited language such as #define in C.
These rewrite rules can be full code walker (compilers) for DSLs, for example.
Which brings more syntax to learn. In lisp you write macros using same langauge as you write your normal code. In fact there's no disticntion between macro code and lisp code.
Template Haskell brings very little new syntax with it. Mostly, it's just $() and [$||] for splicing and using "quasiquoters". All AST manipulations are done in pure haskell (that just happens to run at compile time).
Making new control structures is the same thing as skipping parameter evaluation.
Suppose I wanted to write a while loop in Haskell. (I wouldn't, except as a totally contrived example.):
while :: IO Bool -> IO () -> IO ()
while test m = do
{ b <- test
; if b
then do { m ; while test m }
else return ()
}
This behaves just like a C while loop. It's not like you need laziness for such a thing -- you could do something similar in C#, using Func<bool> and Action in place of IO Bool and IO (), except that if you used recursion, you'd overflow the stack.
The laziness only wins you a slightly nicer syntax.
Lisp macros have mainly two big things for them: One is skipping evaluation and the other is that the result of the macro (which must be code) is evaluated in the context of the position where the macro is applied (i.e. the resulting generated code behaves as if spliced into the expression where the macro was called).
However mentioning only the semantics of macros hides their true power. It is like saying "email's advantage over telephones is that the reception of messages is delayed". Yes, that's true but this small difference lead to whole new ways of communications.
Delayed evaluation and variable binding, yes. Most lisp macros are just sugar for closures, and when you have lightweight syntax for closures ( as in Smalltalk and, to some extent, Ruby), macros become much less important. IMHO.
when you have lightweight syntax for closures, [macros] become much less important.
Anyone who thinks that the one macro they need is one that provides a lightweight syntax for closures -- can simply define this macro and see for themselves. If a word like 'cut' is not sugary enough, CL has reader macros.
Still it's quite comforting, even if not always necessary, to program in Lisp while knowing that a macro can generate virtually any code that can be the output of a function, and not just a way to do things with the closures given to it.
Yes, what you think is true. No, no properly-catechised lisper could manage his nausea well enough to praise Haskell's 'elegant syntax'.
Let Over Lambda will teach you more about macros. The first four chapters are online -- scan the first chapter for 'stylistic aphorisms' to see the target the book paints.
That book definitely has an over-the-top style, but it is part of its charm, not to be taken entirely seriously. The cover is a giant LOL with a lambda in it, for crissakes. But he makes a good case actually. Every page is some mind-bending new use of macros, and it goes way way beyond the simple control of evaluation structures macros are usually used for, or even the nether chapters of On Lisp. If you can get past the style, or even appreciate its uncompromising tone, it is a great read. It is the first time I truly glimpsed this raw power and infinite potential of lisp macros that I had always heard so much about.
About your first quoted sentence: The author's intended meaning might be "This book covers a lot of important points that I learned by experience but no one has written a book about".
Harder for me than any syntax issues are the "mindset" issues I have when I try to learn Lisp and Haskell. I really just don't get it. Perhaps this omission is just a flaw in the books and articles I've tried to read talking about such things. If anyone has any suggestions for quality "big picture" introductions to Haskell (or other functional languages) I'd love to try them out.
Get a copy of Graham Hutton's Programming in Haskell. It's an actual introductory book, intended for students. It's not as complete as Real World Haskell and it doesn't have "real-world" examples like parsing JSON and scanning barcodes. But it's a hell of a lot more accessible.
But Lisp doesn't have a mindset. It has clunky syntax, and its community has some serious attitudinal issues, but you can program any way you want in Lisp. Functional, OOP, imperative, meta, whatever floats your boat. Lisp puts tools at your disposal and lets you do as you please.
It defines a function called doif that takes two parameters x and y. The body of the function is on the right hand side of the =. So in pseudocode imperative something like:
function doif(x,y)
{
if x
then Return (Just y)
else Return Nothing
}
The Just y and Nothing is the way you return something from a function that might not give a proper result - rather like using -1 to mean an error condition when you're returning a positive number.
If you have a decent academic background, I can't recommend enough to read "A Gentle Introduction to Haskell":http://www.haskell.org/tutorial/.
It's a short overview of the language (64 pages) that can get you doing things much faster than any book. Plus, it's written by very relevant members of the community.
9
u/DRMacIver Mar 15 '09
Oh good. The usual mix of trivialities and fallacies one gets when someone starts to get excited about a new language.
Summary version: Haskell supports functional programming, has custom defined operators and I stupidly believed all the people who lied to me about automatic parallelisation of Haskell code.
21
u/stesch Mar 14 '09
I'm wondering if people who write these articles about Haskell actually use it. It seems that most of the time they know Haskell for a few days and think it's cool to crack its code.
5
u/zaqwert Mar 14 '09
Is it true that the main advantage of Lisp macros is they they enable skipping parameter evaluation? I thought they went much further, such as enabling new control structures, etc. But maybe the writer is right and all of their advantages boil down to avoiding evaluation. Is he right?
3
u/newbill123 Mar 15 '09
Harder for me than any syntax issues are the "mindset" issues I have when I try to learn Lisp and Haskell. I really just don't get it. Perhaps this omission is just a flaw in the books and articles I've tried to read talking about such things. If anyone has any suggestions for quality "big picture" introductions to Haskell (or other functional languages) I'd love to try them out.
2
u/[deleted] Mar 15 '09
Looks like drunk Ruby. Can someone explain this to me?
2
u/noamsml Mar 15 '09
Forgot about lisp being homoiconic, which, whether it's useful or not, is part of lisp's "holy shit this is awesome" vibe.
1
u/NeXT_Step Mar 15 '09
If you have a decent academic background, I can't recommend enough to read "A Gentle Introduction to Haskell":http://www.haskell.org/tutorial/.
It's a short overview of the language (64 pages) that can get you doing things much faster than any book. Plus, it's written by very relevant members of the community.
0
u/jdh30 Jul 15 '09
This guy used Lisp for 15 years without looking at the better alternatives?!
Sure, if you want a slow-down as all the time is spent spawning sparks.