Posts tagged: leksah

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.

Summary

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. []

Staypressed theme by Themocracy