Scratch the Itch - A Haskell Bundle for Textmate

GHCi is a pleasure to work with, but the process of reloading your Haskell source file and typing in a new expression can become tedious after a while; in particular when you’re doing a lot of experimentation on a single expression.

This happens a lot to me right now because I’m currently dabbling in audio synthesis in Haskell. I’m making small changes to a parameter and I want to listen to the result immediately. Switching to GHCi forth and back becomes unbearable. I imagine the problem is similar for, say, drawing diagrams in Haskell.

That’s why I’ve taken the time to investigate and rewrite the Haskell bundle for TextMate, my current text editor of choice. The main innovation is that pressing the key combination ⌘+E will search for the enclosing top-level definition and evaluate it with GHC. Mind you, the search is not very robust, but it works for me.

I’ve also introduced a shortcut ⌘+D which is similar, but wraps the expression into a call to the function demo, which you can define at your leisure, for instance as a typeclass member similar to show. This allows me to listen to audio right away.

Without further ado, I’m putting my bundle on github, maybe it’s useful for other people, too. Patches are welcome, but keep in mind that I’m not terribly interested in maintaining Haskell IDE plugins. Maybe other people can pick it up and do useful stuff like uploading it to hackage or integrating it with scion or stealing from EclipseFP.

The code is very much based on Jamis Buck’s original Haskell bundle, but I’ve also changed the syntax highlighting and removed the stuff that I don’t use.


Some HTML formatting is allowed.