Posts tagged: IDE

Haskell IDEs, Part 4: Emacs revisited and Summary

In the previous parts of this post I reviewed three different development environments for Haskell: Emacs, EclipseFP and Leksah. This is the last part in which I plan to write about Emacs once again and then summarize all the reviews.

My main problem with Emacs was inconvenience when working with multiple files, mostly because I found switching between buffers (i.e. opened files) annoying. After posting the review there were comments that recommended extensions that could solve these problems.  Here’s the list of extensions that, after some testing, I decided to use:

  • IDO mode. IDO stands for Interactively Do Things and it greatly improves file opening and switching between buffers. When opening a file it shows the list of files and directories in a current directory, allows to navigate the directory tree in an easy manner, provides intuitive filtering capabilities and allows to select a file easily by selecting its name using arrow keys. Similar behaviour is provided when switching between opened buffers. A nice introductory tutorial to IDO can be found here.
  • NumberedWindows improves switching between multiple windows by pressing the Meta key and a number of a window1. This is much easier to type then C-x o.
  • CycleBuffer allows switching to next/previous buffer using F9/F10 keys. That’s an alternative to IDO-enhanced C-x b command.

These three extensions are a huge win. They greatly improve overall Emacs experience. There’s plenty of other window- and buffer-enhancing extensions that I haven’t mentioned – you can take a look at them on Emacs Wiki here and here.

Right now I’m missing two things in Emacs: a bit tighter integration with GHC/GHCi and a possibility to browse through the source tree. First problem should theoretically not be a problem, since haskell-mode and ghc-mod both offer good integration features but, as I mentioned in my review, some of these features didn’t work as the should or at all. I hope this could be resolved with a small effort. As for the source tree browsing, there are of course extensions. One of them is ECB, but I haven’t tried it yet.


This series was meant to give you a rough idea of what three Haskell IDEs – Emacs, EclipseFP and Leksah – have to offer.  As you’ve seen I was enthusiastic about EclipseFP and Emacs, but very critical about Leksah. I would however suggest not to rely solely on my opinion and test each of these environments on your own. I’ve seen people on #haskell praising Leksah, so perhaps that project is not a lost cause (as my post could have suggested). I also made one omission – vim. There are Haskell modes for vim as well, but I’ve never been proficient in it so when I was faced with improving my vim skills or learning Emacs from scratch, I chose the latter (I think the key factor was the fact that I was learning Scheme at the same time). As a general thought, I have to say that there is no Haskell IDE that would boost my efficiency as a programmer the way Eclipse boosted my Java programming efficiency. I don’t know if such IDE will ever be created, but it would be nice to have at least any kind of refactoring capabilities. At the moment none of the IDEs has such and the programmer has to manually perform repetitious tasks like renaming variables. I’m definitely waiting for this to improve.

  1. Don’t get confused by Emacs’ terminology. A window in Emacs is an area that displays the context of the buffer within a frame. You can split editing area horizontally or vertically and each of these areas is called a window. Term frame is equivalent to what is normally referred to as a window in modern GUIs []

Haskell IDEs, Part 3: Leksah

In the previous parts of this series I presented two development environments for Haskell: Emacs and EclipseFP. It’s time to finish presentation of IDEs with the last one, Leksah – a Haskell IDE written in Haskell.

Leksah was the first Haskell IDE I tried when I started learning the language. I was a total newbie back then (not that I know much more now) and the installation process was very tough going for me. I had all the GHC packages installed from openSUSE repositories, but it turned out that Leksah is not in the repo. This meant that I had to install it using cabal and I wasn’t very keen on idea of having GHC installation managed both by zypper1 and cabal. I described the full story in one of the previous posts, but long story short I removed GHC packages installed from the repo, downloaded pre-compiled GHC binaries and then installed Leksah using cabal. Previously I said that installation of EclipseFP can be tedious, but I should have reserved that word for Leksah. First of all, it’s not easy to find any sort of installation instructions for Leksah. There is a page on Haskell wiki and a user’s manual but both are outdated, manual by about 2 years, wiki even more. Luckily cabal is a smart tool and can manage the installation process quite well by automatically downloading, compiling and installing required dependencies. Since my GHC package repository was bare and Leksah needs a lot of additional dependencies (and I really mean a lot), the whole installation process took Very Long Time. Unfortunately not everything went as smoothly as it should. I recall having some problems with gtksourceview, but #haskell channel came to the rescue and after about 2 hours of struggling with installation (and 3 hours of installing GHC…) I was ready to finally start the IDE. Before we go into details about using Leksah I have to add that upgrading Leksah to newer version was much easier and faster since the dependencies were already present.

When Leksah starts for the first time it needs to collect information about packages available in the system. This, again, takes Very Long Time, so you can get yourself a cup of tea or possibly take a walk. Be prepared to rebuild this database after installing any new packages or upgrading Leksah. The latter doesn’t happen very often, but we’ll get to that later. After drinking your cup of tea (possibly a few) or coming back from the walk – depending which option you chose – you’re finally ready to work with Leksah. Here’s what you get:

List of major features includes:

  • Syntax highlighting. No surprise here. Well, almost. You can’t define your own colours for the editor and you’re limited to a few predefined settings. These colour themes are nice but I don’t see why the user can’t customize them. I also noticed that for some of available settings spaces are not the same width as other characters, which breaks the layout of haddock comments – see the screenshot above. Aside from that the capabilities of Leksah in syntax highlighting are similar to EclipseFP, but the latter gives you customization options and doesn’t have glitches. Anyway, I still think that Emacs wins as far as syntax highlighting is concerned.
  • Cabal file editor. While EclipseFP offers a nice, non-intrusive editor, Leksah will demolish your hand-crafted cabal file. It will insert hundreds of unused sections and completely rearrange an layout you’ve made. Definitely a point for EclipseFP.
  • Automatic compilation and error detection. There is an error pane that shows current compilation errors. Nevertheless, another point goes to EclipseFP since it is able to mark the errors directly in the source code and it can also display HLint warnings. UPDATE: Leksah can also underline errors directly in the code. My mistake here. Nevertheless EclipseFP still has the advantage of HLint integration.
  • Debugging. I still haven’t learned how to use Haskell’s debugger so I really can’t tell how this works.
  • Package browser. It allows you to browse through available packages or packages in your project, but it’s so clumsy that I don’t consider it useful in any way. EclipseFP wins once again.
  • Autocompletion. This is the only thing that seems to work better in Leksah than in EclipseFP. It is more reliable, uses syntax highlighting to display completion suggestions and displays information about package from which a function is imported. A point for Leksah.

Generally, Leksah is extremely clumsy and not really convenient to work with. Interface is cluttered, full of bugs and glitches: text labels aren’t displayed properly, it’s hard to manage panes layout (not impossible, but hard), some panes don’t show up although they should, some commands from menus and context menus don’t work. The graphical interface is really more of problem in Leksah than actual aid for the programmer. Just to give you the idea of how poor an IDE Leksah is: only in the recent version 0.12 (released in March 2012) was the pane displaying the files in the project added. It is a very simple tree widget with no icons of any kind, no drag-and-drop features and no context menus that would allow you to manipulate layout of the project in any way. I couldn’t also find a way to increase the size of the editor in any reasonable way. There’s an option to disable the toolbar and editor tabs, but that’s all. No way to work in the full screen2, no way to get rid of two status bars.

My attempts to develop code in Leksah were really painful and honestly speaking I can’t find a good reason why should anyone choose it as a Haskell IDE. Leksah is buggy, inconvenient, annoying and lacks features. I don’t expect this to change quickly, ’cause the development process is very slow. The previous stable version 0.10 was released in April 2011, the current one in March 2012. That’s eleven months of waiting only to get some minor features that definitely don’t solve Leksah’s problems as a whole. Considering what was said above my advice is simple: if you want a graphical IDE, use EclipseFP.

The only thing that’s left in this series of posts is a general summary and a small addendum about Emacs. Be on the lookout for part 4.

  1. zypper is openSUSE’s RPM package manager []
  2. Don’t get mislead by the screenshot I provided. There’s no window decoration on it, but Leksah is really working in a window, not fullscreen. []

Haskell IDEs, Part 2: EclipseFP

In the previous post I wrote about using Emacs as a Haskell development environment. Today we’ll take a look at EclipseFP, a plugin that enhances Eclipse with Haskell support. Let’s begin with a brief overview of Eclipse.

If you ever programmed in Java than you almost certainly know Eclipse. This is one of the most popular IDEs for that language and in my personal opinion it’s the best one, much better then crappy NetBeans. Originally it was a project started by IBM, but it’s currently managed by the Eclipse Foundation. Eclipse is written in Java, uses native OS look-and-feel thanks to SWT (Standard Widget Toolkit) and has modular architecture that allows it to be extended with plugins. There are a lot of plugins for Eclipse, just as there are many extensions for Emacs, e.g. they allow to extend basic installation with support for version control systems or integrate with bug tracking and team collaboration software. Most importantly however plugins allow to use Eclipse as an IDE for languages other than Java (among them Haskell1). When I learnt Eclipse years ago it greatly boosted my efficiency as a programmer. Great keyboard shortcuts, good Test Driven Development support, refactoring and code generation capabilities allowed me to focus on important things relieving me of many repeatable tasks. There are also some downsides, one of them being the plugins: install too many and Eclipse will get cluttered with tens of additional options and menus. This is not a major problem though and when I start with a new programming language I usually begin by searching for Eclipse plugin (I admit that recently I also check Emacs extensions). Since I’m very used to Eclipse, with the learning curve already far behind me, I’m biased towards it.

Let’s see what EclipseFP has to offer. Installation turned out to be tedious, since the plugin requires many additional libraries from Hackage. If you already have them – and chances are that you have Hoogle, HLint or QuickCheck – this will be easier, but I had none, so it took some time (nothing complicated though). First problem appeared right after installation. Each time I started Eclipse, Hoogle reported that it has no database and asked if it should be built. Telling Hoogle that it should do it gave no result and the message reappeared each time Eclipse was started. It turned out that the database couldn’t be built because of permissions. Hoogle was installed system-wide and required root privileges to write the database somewhere in /usr directory, while Eclipse was run as normal user. Building the database as root from the command line solved the problem.

List of EclipseFP features is long: syntax highlighting, autocompletion (could be better though), HLint and Hoogle integration, GHCi integration, cabal file editor, profiling support, exporting Haddock documentation – to name some of them.  You can of course benefit from standard features of Eclipse as well as other plugins, e.g. using SVN or GIT integration in your Haskell project. Here’s a glimpse at EclipseFP in action:

No much surprise here: editor with multiple tabs, overview of project structure on the left, GHCi at the bottom. The only thing you may find odd is lack of menus and toolbars. These were disabled by a plugin that allows Eclipse to run in fullscreen mode to use as much screen space as possible. Even with this plugin enabled and editor window maximized (panes at bottom and left can be closed) there’s still less code on the screen comparing to Emacs. Emacs has 37 lines, EclipseFP and Leksah have 32 lines, but that of course depends strongly on your settings. Syntax highlighting could be better in EclipseFP. Both Emacs and Leksah offer more. An important thing to note is very good cabal build system integration. First of all, cabal file editor is non intrusive, so if you edit your files by hand, then use a graphical frontend, and then go back to hand editing you won’t notice anything2. EclipseFP also notices missing build dependencies in the cabal file and can automatically add them for you.

Concluding, EclipseFP nicely integrates Haskell development within Eclipse framework. If you ever developed Java and enjoyed Eclipse, then you must try out EclipseFP. I found EclipseFP much easier to use than Emacs for developing a larger project, most likely because I have many years of Eclipse experience vs. couple of weeks of Emacs experience. I still prefer Emacs to code some simple stuff that fits in one file, but I’m not giving up on Emacs as a project development environment3. Some things in EclipseFP could be improved – syntax highlighting is certainly one of them – but I haven’t found anything that I would consider a serious drawback. One thing that concerns me is the fact that EclipseFP is at the moment a single-person project (it is developed by JP Moresmau). Currently the development cycle seems to be quite stable, but I learnt that such projects can die instantly when the sole developer abandons them. It’s a pity there is no community around this project. I think this can be caused by the fact that it’s aimed at Haskell programmers, but you actually have to be a decent Java developer with solid knowledge of Eclipse RCP to contribute. I hope that I am wrong and no such thing will happen, since EclipseFP seems to be the most reasonable choice for people who want to develop Haskell but don’t fancy learning Emacs.

  1. In case you’re wondering, there are plugins for other functional languages: Scala (it’s a mature plugin and works decently), Erlang (this plugin on the other hand was quite buggy and I had to remove it), Clojure and Scheme (I use Emacs for LISP so I don’t know about these two).


  2. As you’ll see in the future post this is not the case with Leksah []
  3. I installed some more plugins (thanks to people who commented on my previous post), so expect a follow-up []

Staypressed theme by Themocracy