Skip navigation.

The whole Enchilada

A sequence of thought

Enchilada in Haskell

For the past three weeks i've been porting Enchilada to yet another language, this time Haskell. The reason? I didn't like the Factor code I was writing: it turned out to be too Object Oriented. I also experienced a lot of runtime errors at tricky corner cases. But most importantly, I couldn't understand the Factor code I wrote months ago.

This isn't the fault of Factor of course: it's just that my coding style currently doesn't go well with idiomatic Factor code. Nevertheless, I can say that manipulating the stack without using named parameters was painful at times. Probably that's because I didn't factor my code enough. Anyway, I wanted to give Haskell a try, just to see if I my coding style could benefit (=cleaned up) from strong typing.

And I must say that I'm very impressed with the result. Besided strong typing, type classes, higher order functions, etc, Haskell's laziness has given me new ways of expressing Enchilada's algorithms more succinctly. Another big plus is that Haskell's pureness matches that of Enchilada, which probably gives GHC an opportunity to optimize certain algorithms and data structures more agressively. And not surprisingly: my Haskell code turned out to be very easy to (re)read (at least for me).

But the most interesting result is that the Haskell implementation of Enchilada runs MUCH faster than the previous Java and Factor implementations I did. The Glasgow Haskell Compiler is a very amazing piece of technology indeed.

Fingerprinting distributed computationOrder, probability and fast equality

Comments

Sjoerd Visscher 5. August 2007, 19:26

That's really cool. I assume you are going to put this code online? I tried to read the java code, now I am curious if I can follow the Haskell code better.

Robbert van Dalen 6. August 2007, 05:41

I'm currently polishing some of the rougher edges before I'll do the full public release.

Also, the current site (enchilada.javaforge.com) doesn't really apply anymore. I guess I have to find another place to host both the factor and haskell version of enchilada.

Write a comment

You must be logged in to write a comment. If you're not a registered member, please sign up.

December 2009
S M T W T F S
November 2009January 2010
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31