A quick start guide to Haskell programming with Eclipse

This document shows how you would create and run the 'Hello World' application in Eclipse with Haskell support. It also explains some of the main user interface elements in Eclipse. The focus is on helping developers who are not familiar with Eclipse to quickly get started with it as an IDE that supports Haskell development.

Note: This is work in progress, which means that some of the features described here may not yet be in place.

Preparations

Create and edit source files

Add source files to the project source folder.

If you have selected "executable" in the new project wizard page, a Main.hs file should have been created for you. Otherwise you can create a new Haskell module from the menu (File > New > Haskell > Haskell Module). The second page of the wizard lets you choose in which component the module will be present. You can have a project with several components, and not all modules are present in all components.

If you give the files a Haskell-specific extension (like .hs or .lhs (for literate Haskell), you can open the files with the Haskell source code editor from the Project Explorer view.

You can configure the editor in the main Preferences Dialog: Select Window > Preferences from the menu and choose the General > Editors > Text Editors section.

Run the application

You can launch the compiled executable of your Haskell programs from within the IDE.

Running a program creates a new Launch configuration for that program. You can re-run a lauch configuration from the Run menu. Clicking the Run-icon re-launches always the last launched configuration.

If you choose Run ... from the menu, you get a dialog where you can edit launch configurations. For example, you may want to add parameters to the program launch.

Console input and output are handled by the Console View (at the bottom left of the workbench). You should see the 'Hello world' output appear there, and if your program takes console input, the Console View is where you can type in while developing.

Run a module in the interpreter

You can right click on any Haskell module and choose Run GHCi session. This will open GHCi, the GHC interpreter, in a Eclipse console, and load all the required modules.

You can type in that console and have a full interactive session, modifying your modules in the Eclipse editors and running code in the console

The launch configuration options for interpreter sessions let you configure some automation features, like automatically reloading modules that you've saved in the editor.