Tuesday, 28 July 2009

Learn you a Haskell for great good: a fantastic tutorial

In the process of trying to learn the Haskell programming language we stumbled upon a really fantastic tutorial called "Learn You a Haskell for Great Good!". This is by far the best tutorial we have ever read on Haskell and, in particular, is infinitely better than any of the books on Haskell including the recent Real World Haskell book.

For anyone wanting to get to grips with the basics of Haskell programming, we highly recommend this resource.

Wednesday, 8 April 2009

Hash table woes

Recent performance studies have shown that Haskell's defacto-standard compiler, GHC, still bundles an extremely inefficient hash table implementation. Specifically, the benchmark showed optimized Haskell compiled to native code running even slower than interpreted Python and 32× slower than F#.

Surprisingly, the poor performance turned out to be due to a design flaw in the implementation of GHC's garbage collector that renders it incapable of handling updates to arrays of boxed types efficiently.

Contrary to a statement in the book "Real World Haskell", trees are incapable of providing comparable performance for the majority of use cases. Therefore, it is extremely important that this deficiency is addressed because, without a decent hash table implementation, almost all dictionary data structures will be over an order of magnitude slower in Haskell than other functional languages such as OCaml and F#. Suffice to say, hash tables are an extremely valuable data structure and failing to provide a decent implementation is a serious shortcoming.

Although Haskell programmers have been complaining about the poor performance of its hash tables for at least three years, Donald Stewart has just promised to address the issue by implementing a new and reasonably-performant hash table for GHC.

Lennart Augustsson releases his embedded BASIC

Lennart Augustsson, author of the world's first Haskell compiler, has released the much-anticipated source code to his BASIC DSL written in Haskell that uses LLVM for JIT compilation.

Lennart has been teasing us with a series of fascinating articles describing the elegant DSL capabilities offered by his latest work and it is great to finally have something to play with!

This project demonstrates how the Haskell programming language combined with FFI bindings to LLVM's C API can be used to construct new language implementations quickly and easily.

Functional languages excel at metaprogramming and there are several similar compilers written in functional languages that are buildinng upon LLVM including our own HLVM project that is written in OCaml and provides a complete high-performance garbage collected virtual machine in under 1,000 lines of OCaml code.

Friday, 27 March 2009

XMonad popularity

Donald Stewart kindly took the time to analyze and document the download statistics for his xmonad package, a tiling window manager written in Haskell. His results prove that xmonad has been downloaded tens of thousands of times even though the project is not yet 3 years old.

Donald also notes that the number of source downloads dropped dramatically when xmonad became available prepackaged for all mainstream Linux distributions. This indicates that the Debian and Ubuntu popularity contest results (distros that cover over 70% of all Linux users) for xmonad should be accurate estimates for the current number of active xmonad users. According to those results, users are currently running around 180 registered copies of xmonad, making it the second most popular program ever written in Haskell!

Following the success of this analysis, Donald has announced his intention to automate this procedure in order to provide accurate download statistics for the thousands of Haskell packages currently available.