Comments on Haskell

From Slashdot:

The thing about functional languages, and strict lazy functional languages like Haskell, is that the underlying principles are quite different from procedural languages like C. In C, you tell the computer to do things. In Haskell, you tell the computer the relationships between things, and it figures out what to do all on its own.

Personally, I suck at Haskell — I’m too much of a procedural programmer. My mind’s stuck in the rails of doing thing procedurally. But I’d very much like to learn it more, *because* it will teach me different ways of thinking about problems. If I can think of an ethernet router as a mapping between an input and output stream of packets rather than as a sequence of discrete events that get processed sequentially, then it may well encourage me to solve the problem in a some better way.

Hascal, and other functional languages may be good for multi-core development. However not to many programmers program in them… Plus I find they do not scale well for larger application. Its good for true computing problem solving. But today most developopment is for larger application which doesn’t necessarly solve problems per-say but create a tool that people can use.

The truth is that the vast majority of the software out there does pretty dull, mostly procedural jobs. That’s why the main languages in use are just dull variations on the procedural, C/Java/Perl style. No matter how much maths geeks go on about functional programming, procedural systems will always be more suited and easier to use for most of the problems out there.

The point is that there’s nothing those languages can do that can’t be done, often more easily, with the current crop of popular languages. Elegance cannot beat convenience in the workplace, or in most at any rate.

Your real problem with Haskell is that it is more complex per written token, and so you have to think more per token. Most people seem to generate some inner fear for things they don’t understand as good as they expect. And that’s the base of all your motivation to find reasons why you dislike Haskell. Of course you could simplify it, and get something like Python. But this is a bad idea on the long run, because then nature will only create bigger idiots. It’s better to wise up a bit, because what you get then, is really really nice!

A pure functional language would be a language where there are no side effects. I.e., you can’t change the state of anything, you can only construct new things out of existing things. As this gives some problems with IO, Haskell, taking purity to the extreme, had to wait for the invention of Monads to be able to do IO. Yes, Haskell was not capable of IO (reading/writing) for years. Functional languages follow this pattern: side-effects are only permitted if there is no other way. Examples are Lisp and Scheme, but also Matlab, Mathematica and Scala. Other languages allow side-effects by default, and have functional aspects in other respects. Examples of these are Javascript, Ruby, Python, Java, C++, C and even assembler (programming without any functional aspects is going to be hard). Quite likely Javascript programming can be done almost purely functionally. But so can C.

Don’t be ridiculous. Functional vs procedural isn’t a matter of intelligence. It’s simply a way of thinking. And the reality is that procedural languages better match the way the human mind works.

IMHO, learning to program in a functional style is like a right-handed person learning to write with their left. Yeah, they can do it, but it requires a ton of work for dubious real-world benefit, and in the end, it’s never really natural, simply because that’s not the way the brain is wired (except for the odd freakish exception ;).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s