Posted on November 5, 2012 by rodney
Tags: dev, haskell

Recently I have been trying to use Haskell for development. It is a nice language which lets you write beautiful functions and programs. The language is becoming more popular and you can now write web apps with it.

I want to use Haskell more because I’m certain it will make me a better programmer.

I did a basic course in uni on it, have read a book or two about it, and have made some simple programs with it. But I’m still not yet proficient. Apart from the obvious fact that I am a bit of a dummy, there seem to be a number of impediments to proficiency.

  1. Haskell is better but other languages are good enough.

For example, I wrote a simple HTML scraping and picture downloading program in Python. Within 30 minutes it was fully functional including such bells and whistles as proper command line argument parsing and error handling.

I tried to write exactly the same thing in Haskell using HXT and it took several hours reading documentation, battling the type checker, and a visit to #haskell on freenode to get it going.

It’s difficult to leave the comfort zone of Python.

  1. It’s difficult to find documentation even though it’s all online.

The Haskell module system is designed so that if you import Module you get all the symbols from that module in your namespace. If you’re looking at someone else’s code, it’s hard to tell where a function comes from.

Haskell modules are usually divided into submodules. It’s not obvious which submodule to look in for a function you might want to use. Each library has its own index page, but there is no global index of functions from all libraries.

The documentation for the Prelude (the basic and fundamental Haskell functions) is in a different format than all other documentation.

Sometimes you have to import a certain module to get a required typeclass instance. If you don’t import the module, you get a massive type error, as is standard for Haskell. The way you know that a module needs to be imported is because it’s imported in some example code which works.

Often there is extra documentation for a module on the Haskell wiki or written as an academic paper in a PDF. I can’t see why this can’t be put into the Haddock for the module.

The search tools Hoogle and Hayoo are amazing but require connection to the Internet. Also they seem to do roughly the same thing. Why are there two?

  1. There are multiple libraries which do the same thing.

For example, Snap/Yesod, hdbus/dbus-core, HaXml/HXT, etc. etc.

How do you choose which one? I know this is a problem for many languages.

But it seems like there are more alternatives for Haskell because in this language style is important and authors will create new APIs to do the same thing simply because they have found a more elegant/powerful construction.

Despite these impediments, I am enjoying learning more about Haskell and trying to put it into practice. Having multiple libraries and documentation sources is definitely better than no libraries and documentation.