Sunday, June 07, 2015

ghcid 0.4 released

Summary: I've released a new version of ghcid, which is faster and works better for Vim users.

I've just released version 0.4 of ghcid. For those who haven't tried it, it's the simplest/dumbest "IDE" that could possibly exist. It presents a small fixed-height console window that shows the active warnings/errors from ghci, which is updated on every save. While that might not seem like much, there are a number of improvements over a standard workflow:

  • You don't have to switch to a different window and hit :reload, just saving in your editor is enough.
  • It includes warnings from modules that successfully compiled previously, as opposed to ghci which omits warnings from modules that didn't reload.
  • It reformats the messages to the height of your console, so you can see several messages at once.

I find it gives me a significant productivity boost, and since there is no editor integration, it adds to my existing tools, rather than trying to replace them (unlike a real IDE).

Version 0.4 offers a few additional improvements:

  • We use fsnotify to watch for changes, rather than polling as in older versions. The result is a significant decrease in battery usage, combined with faster responses to changes.
  • If you change the .cabal or .ghci file then ghcid will restart the ghci session to pick up the changes.
  • If you are a Vim user, then the sequence of temporary files Vim uses on save could upset ghcid. I believe these issues are now all eliminated.
  • The number of errors/warnings is displayed in the titlebar of the console.
  • There is a feature to run a test after each successful save (using --test). I am expecting this to be a niche feature, but feel free to prove me wrong.

Tempted to give it a try? See the README for details.

5 comments:

  1. "If you are a Vim user, then the sequence of temporary files Vim uses on save could upset ghcid. I believe these issues are now all eliminated." <-- This makes me happy. Ghcid is extremely useful and was always saddened that it couldn't be friend with Vim!

    Thanks again for this useful tool!

    ReplyDelete
  2. Francesco: Do let me know if you still have issues - I don't use Vim, but a few people on the bug tracker have reported success. I found a few issues while auditing for Vim problems - a few "race conditions" (not monitoring a file before reading it, reading a file without waiting for it to reappear, not monitoring files that get deleted) all of which I think were contributing to the Vim issues.

    ReplyDelete
  3. The feature to run a test seems to be the thing I've been looking for a long, long time. I actually made a build system using gulp to run `cabal test` every time a file changed. I haven't actually downloaded it yet - do you supply a module/function to run or does it work some other way?

    ReplyDelete
  4. Callum: It takes an expression in ghci, which can call a function.

    ReplyDelete
  5. Thank you for ghcid. I'm using it with vim (gvim) right now, and it is fantastic.

    ReplyDelete