Haskell Rapid Transit
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:
- 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…