Words by c.z.robertson

Abandoning Haskell

2005-04-05 16:09:36 GMT/BST

A few weeks ago I decided that it was time to learn another programming language. I've been working predominantly with Perl for the last couple of years and I've started to see every programming problem in terms of its Perl solution. So, time to shake things up a bit.

I decided to try Haskell. I had (a very small amount of) exposure to it at university and I'd since read a bit about its type system. And of course it's a functional language and I spend most of my time in procedural languages. So I thought it would be a reasonable place to start.

I set myself a small task: to automatically update my blogroll. As of this writing, I've switched from Straw to Blam and the blogroll hasn't been updated for months. It is a small task. Just parse an XML file and generate an HTML fragment. Actually since Blam doesn't store the site that the RSS feed relates to I'd also want to fetch each RSS file and extract the site URL and preferably cache that as well. But still, it's no more than an hour's work in Perl.

Now, after a good number of hours over the last few weeks, I still haven't succeeded in actually extracting any data from an XML file using Haskell.

I like to think that I'm a reasonably intelligent person. I've programmed in numerous languages over the last decade or so. And I'm not afraid of functional languages. So if I can't get data out of an XML file after weeks of trying, I start to think that maybe the language has some problems, and maybe it's not worth my time to learn.

Some of my time has been spent aquiring the compiler and learning how to use it, but that wasn't too bad.

Some if it was spent getting XML parsing libraries and figuring out how to compile and install them. That was a bit painful. Haskell has a library packaging system that looks excessively complex. And it really wants to install things in /usr and not in my home directory. Unless it's in a .deb package I won't install anything outside my home directory.

But most of my time was spent trying to figure out how to use HXT's XPath facilities to extract data from an XML file. I'll admit, I don't really understand monads. And I'll have to understand them if I want to use HXT.

But after all these weeks, in which I've achieved close to nothing, my patience has just run out. I don't care enough to continue. And when I realised this weekend that, if I did succeed in parsing the XML, I'd have to go straight on to HTTP requests, I just thought "I can't be bothered". So I'm giving up. Maybe I'll try Ruby instead.