Skip to content

Haskell Rapid Transit

October 21, 2010

In the book Smalltalk-80: Bits of History, Words of Advice the Smalltalk team talks about how important it is get the development cycle of edit/compile/test fast enough that the programmer doesn’t lose focus. While I love a fast compile time as much as the next programmer, I’m always surprised at what a qualitative difference such a change makes.

Take my current Haskell based web project, for example. It’s actually pretty small, so development cycle is pretty quick:

  • In editor: Save source file edits
  • In terminal: cabal build
  • In terminal: ghci -isrc:dist/build/autogen src/Main.hs
  • In ghci: :main start playground
  • In web browser: Reload page

Total time: 1 minute, 10 seconds. That is, if I don’t have to reconfigure, or the long-ish ghci line is not nearby in my history buffer… or I didn’t close the tab so I have retype the URL to the web application.

But it turns out my Haskell based web project is sneaky: It is a small web-based Haskell development environment… And it is mostly self-hosting. So, I only need to do the above sequence when I’m changing something in the core server. Most of the time, when I’m editing the development environment itself, I can do this:

  • In web browser, on page with editable Haskell source, and live preview: Click Save

Total time: 1.4 seconds.

That is a big difference in time, but even more in focus: My mind never leaves the code at hand. I can recompile and view many more times, and so I choose to compile each small change and deal with compilation errors as I’m writing each code snippet. I can iterate many more times on a piece of code without losing context or perspective. And I get to see it running every step of the way.

Starting to feel just like it did when I first coded in Smalltalk-80…

Okay, enough teasing: The project isn’t even at a 0.1 release, but here is a screen shot, and, if you must, a reference to the github repository. Enjoy…


From → Software

  1. okay permalink

    Any reason you don’t run cabal and ghci from inside your editor?

  2. Ivan permalink

    This sure looks neat! I think I’m going to give it a try ;D

  3. @Ivan: Great – but heed the README, and remember that were not even at an alpha release yet.

  4. @okay: Sure, some editors offer that kind of integration, to varying degrees. Really good integration, where the cabal and ghci consoles are opened in-line in the editor, and so on, can substantially save time and focus. And getting my editor to switch to my browser and reload automatically after successful build is probably configurable, but at the expense of yet more yak shaving. Of course, the more they do this, the more they look like IDEs or the kind of rapid development environment we’re creating…

  5. rob permalink

    Is this wheat redux?

  6. Well… It certainly shares many of the same ideas about development. But this is more practical and aimed at smaller projects. It also has a more traditional model of web page generation.

Comments are closed.

%d bloggers like this: