Blog Archive

Haskell-NXT

I have begun writing a Haskell library to remotely control Lego Mindstorms NXT Bricks via Bluetooth. I just uploaded the repository to github at http://github.com/janv/haskell-nxt.

The library is far from complete, there’s lots and lots of unimplemented commands and it’s not even working with USB-connections yet. It doesn’t run on windows since it communicates via POSIX device files. Don’t ask me how to create these on Linux, it was dead-easy under OS X.

But release early, release often they say, so here you go.

Getting Cabal to run on Mac OS X Leopard

In preparation for the work on my Haskell NXT Library, I needed to install Yampa today. The official page lists version 0.9.1 as most recent, though that release is from 2002. Newer (though kinda “inofficial”) versions are available through Hackage/Cabal. Getting Cabal to work wasn’t difficult at all in the end, but scraping together all the information on how to get there was a bit tricky for an absolute n00b like me. I publish my steps here so that others trying to get Cabal to run on Leopard (or other systems) can save some time.

First, you should have GHC installed via MacPorts (sudo port install ghc)

I installed darcs too, but I don’t even think that was necessary (sudo port install darcs)

Now, the most recent Cabal Library (the one included in MacPorts GHC was a bit outdated):
Go to http://haskell.org/cabal/, download and untar the most recent Cabal (library) and cabal-install (commandline interface) packages. Install Cabal as root, as described in the readme-file:

ghc --make Setup.hs
./Setup configure
./Setup build
sudo ./Setup install

For cabal-install to compile, we need to further libraries, HTTP and zlib, both obtainable in the HackageDB (just follow the links). Download and untar, then proceed as with Cabal:

ghc --make Setup.lhs (.lhs in case of HTTP, zlib uses the .hs extension)
./Setup configure
./Setup build
sudo ./Setup install

Finally change to the cabal-install directory and repeat these steps again.

After cabal-install is installed, run cabal update to obtain the latest package list. Now you can install packages via cabal install <package name>

The monad tutorial to bind them all

Many thanks to zipMe who provided some extremely valuable links in the comments to my last entry. You could have invented monads is the monad tutorial I have always longed for.
It explains the basics (the monad interface) and then describes how these basics can be used to achieve the various stuff you always see monads being used for (sequential programming, side effects) all with very focused examples and excercises, without much Haskell background needed. Not too theoretical to recognize the connection to Haskell, nor too practical to provide insight about the ideas behind monads.

Update on F# and Haskell, especially monads

Since I wrote about F# in August, my progress has been rather slow.
There was a lot of work to do for Uni, almost all involving final touches to Pavel, the data-analysis tool me and a few other students have developed as a student research project. We’ll publish Pavel next week on SourceForge, I’ll write a few lines about it then.

Another thing that has held me back is my fascination for Haskell. more…

F# Observations

I’m feeling all mad-scientistic tonight, sipping coke, with 30 tabs open in Opera :)

On my journey into the weird world of functional programming on the .NET CLR, I continue to stumble upon interesting stuff. Papers, articles, interviews, each worthy of hours of dedication. Alas, my day still has only 24 hours (I need to work around that somehow), so at the time being I can’t do much more than glance over everything. more…

An apple a day…

Wie heisst die Faustregel doch so schön? “Lerne jedes Jahr eine neue Programmiersprache”

Bisher schlage ich mich damit ganz gut:

2007: ein bißchen Python
2006: C#, Ruby, Javascript
2005: genug C++ um da in Zukunft einen Bogen herum zu machen, genug Haskell um ein permanentes distanziertes Interesse zu erhalten das vielleicht irgendwann durchschlägt in ernsthafte Auseinandersetzung.
2003/2004: Java
1999-2002: PHP, SQL more…