Sunday, September 12, 2010

Getting started with Leksah

I've been wanting to try Leksah for some time, but found that it doesn't give you many cues about how to get started when you first run it. Today, I sat down and got a simple example running.

Here's how to get a simple Haskell program running in Leksah:

  1. Open Leksah. If this is the first time you're running it, just hit OK when asked for search paths and wait for a bit (possibly quite a bit) while it indexes your installed packages.
  2. Click "Workspace | New Workspace" and specify a location for the Leksah workspace, which is a single file that will track references to the Leksah projects you'll create.
  3. Click Module | New Module. This creates a new Cabal module under your workspace. The New Module dialog is looking for a folder which will hold the Cabal files. Create a new directory, navigate to it, and press Open.
  4. Press the Save button at the bottom of the Package tab.
  5. Write your code within the module you created. Note that Leksah will complete function names as you type. It will also repeatedly compile your package and show the output in the Log window to alert you to errors.
  6. Use the package menu to run your code or to install it via cabal. Your output will appear in the Log pane.

Hope that's helpful!

1 comment:

  1. Thanks for this. One issue is that many people (ex: me) have pre-existing projects that they might want to start editing with Leksah. Presumably I can import packages, but it isn't apparent how (Packages menu doesn't have it, opening a .cabal doesn't cut it).