The IDE world in Haskell is incomplete, but is in motion. There are many choices. When choosing your IDE, there are the following things to consider.
1 Notable features of interest to consider
This is a list of features that any Haskell IDE could or should have. The IDEs listed below generally support some subset of these features. Please add more to this list if you think of anything. In future this should be expanded into separate headings with more description of how they would desirably work.
- Syntax highlighting (e.g. for Haskell, Cabal, Literate Haskell, Core, etc.)
- Macros (e.g. inserting imports/aligning/sorting imports, aligning up text, transposing/switching/moving things around)
- Type information (e.g. type at point, info at point, type of expression)
- Intellisense/completion (e.g. jump-to-definition, who-calls, calls-who, search by type, completion, etc.)
- Project management (e.g. understanding of Cabal, configuration/building/installing, package sandboxing)
- Interactive REPL (e.g. GHCi/Hugs interaction, expression evaluation and such)
- Knowledge of Haskell in the GHCi/GHC side (e.g. understanding error types, the REPL, REPL objects, object inspection)
- Indentation support (e.g. tab cycle, simple back-forward indentation, whole area indentation, structured editing, etc.)
- Proper syntactic awareness of Haskell (e.g. with a proper parser and proper editor transpositions a la the structured editors of the 80s and Isabel et al)
- Documentation support (e.g. ability to call up documentation of symbol or module, either in the editor, or in the browser)
- Debugger support (e.g. stepping, breakpoints, etc.)
- Refactoring support (e.g. symbol renaming, hlint, etc.)
- Templates (e.g. snippets, zencoding type stuff, filling in all the cases of a case, etc.)
2 Open Source
- Eclipse is an open, extensible IDE platform for "everything and nothing in particular". It is implemented in Java and runs on several platforms. The Java IDE built on top of it has already become very popular among Java developers. The Haskell tools extend it to support editing (syntax coloring, code assist), compiling, and running Haskell programs from within the IDE. In more details, it features:
- Syntax highlighting and errors/warning highlighting
- A module browser showing all installed packages, their modules and the contents of the modules (functions, types, etc.)
- Integration with Hoogle: select an identifier in your code, press F4 and see the results in hoogle
- Code navigation: from within a Haskell source file, jump to the file where a symbol in declared, or everywhere a symbol is used (type sensitive search, not just a text search)
- Outline view: quickly jump to definitions in your file
- Quick fixes on common errors and import management
- A cabal file editor and integration with Cabal (uses cabal configure, cabal build under the covers), and a graphical view of installed packages
- Integration with GHCi: launch GHCi inside Eclipse on any module
- Integration with the GHCi debugger: performs the GHCi debugging commands for you from the standard Eclipse debugging interface
- Integration with HLint: gives you HLint warning on building and allows you to quick fix them
- Integration with Stylish-Haskell: format your code with stylish-haskell
- Test support: shows results of test-framework based test suite in a graphical format. HTF support to come soon.
- Syntax highlighting in Eclipse can be achieved using the Colorer plugin. This is more light weight than using the EclipseFP plugin which has much functionality but can be messy to install and has sometimes been a bit shaky.
- Eclipse Colorer is a plugin that enables syntax highlighting for a wide range of languages. It uses its own XML-based language for describing syntactic regions of languages. It does not include support for Haskell by default, but this can be added using the syntax description files attached below.
- Installation instructions
- Install the Colorer from the update site
http://colorer.sf.net/eclipsecolorer/(for more detailed instructions see the project page).
- Download the Haskell syntax description files in Haskell_Eclipse_Colorer.tar.gz.
- Extract its contents (haskell.hrc and proto.hrc) into the following directory (overwriting proto.hrc):
eclipse_installation_dir/plugins/net.sf.colorer_0.9.9/colorer/hrc(sometimes the wiki seems to create a nesting tar file, so you might have to unpack twise).
- Finished. A restart of Eclipse might be required. .hs files should open with syntax highlighting.
- Install the Colorer from the update site
- If .hs files open with another kind of syntax highlighting check that they are associated with the Colorer Editor (Preferences -> General -> Editors -> File Associations). Or right click on them and choose Open With -> Other -> Colorer Editor.
- Sometimes the highlighting gets confused. Then it might help to press Ctrl+R and re-colour the editor.
- Use the Word Completion feature (Shift+Alt+7) as a poor man's content assist.
- Use the standard External Tools feature in Eclipse to invoke the compiler from inside the IDE.
- Use the Block selection feature (Shift+Alt+A) to insert/remove line comments on multiple lines at the same time.
- Some other useful standard Eclipse features include the Open resource command (Ctrl+Shift+R), the File search command (Ctrl+H) and the bookmarks feature (Edit -> Add bookmark). Make sure to check Include in next/prev navigation box (Windows -> Preferences -> General -> Editors -> Text Editors -> Annotations -> Bookmarks).
- Leksah is an IDE for Haskell written in Haskell. Leksah is intended as a practical tool to support the Haskell development process. Leksah uses GTK+ as GUI Toolkit with the gtk2hs binding. It is platform independent and should run on any platform where GTK+, gtk2hs and GHC can be installed.
- This IDE supports many languages. For Haskell it currently supports project management, syntax highlighting, building (with GHC) & executing within the IDE.
This may or may not be up to date. A Vim user should update it.
- Haskell-vim-now -- Full-featured Vim config with install script. Supports type inspection, linting, Hoogle, tagging with codex+hasktags, unicode concealing, and refactoring.
- Haskell mode for Vim by Claus Reinke - These plugins provide Vim integration with GHC and Haddock.
- Syntastic -- An extremely useful Vim plugin which will interact with ghc_mod (when editing a Haskell file) every time the source file is saved to check for syntax and type errors.
- SHIM by Lars Kotthoff -- Superior Haskell Interaction Mode (SHIM) plugin for Vim providing full GHCi integration (requires Vim compiled with Ruby support).
- Haskell Conceal -- shows Unicode symbols for common Haskell operators such as ++ and other lexical notation in Vim window (source file itself remains unchanged).
- by Ian Lynagh: distinguishes different literal Haskell styles (Vim 7.0 includes a syntax file which supersedes these plugins).
- There's a copy of lhaskell.vim on the Wiki.
- by Marc Weber -- Vim script-based function/module completion, cabal support, tagging by one command, context completion ( w<tab> -> where ), module outline, etc
- Vim indenting mode for Haskell
- neco-ghc pragma, module, function completion.
- Hdevtools - gives type information, quicker reloading and more.
- Addition list with some missing here with screen shots of many of the above.
Atom is very similar to Sublime Text 2 (which is now discontinued). A huge package database exists and two packages important to haskell developers are:
FP Complete has developed a commercial Haskell IDE.
It's in the cloud, and comes with all of the libraries on Stackage ready to go. (Basically, the Haskell Platform on steroids.)
It's "in the cloud," which has its pros and cons.
The standard IDE is in your browser, and has integration with Git and Github. Emacs, Sublime and Vim support will be released soon. One particularly cool feature is that you can spin up temporary web servers to test out the Haskell-powered website you might be coding up. It's really easy, and you can pay for FP Complete to host your permanent application, too.
There's a free trial, with free academic licenses and paid commercial licenses. There will be "personal" licenses in a few weeks (from early Sept 2013) as well, since the commercial pricing is a bit steep for hobbyists.
3.1.1 Feature set
Some of the features:
- Hoogle searching of all of Stackage.
- Hoogling in the context of a module and its imports.
- Live typechecking/recompiling / jump to error.
- Hlint suggestions.
- Jump to definition.
- Auto-removal of unnecessary imports.
- Get type of any identifier (globally or locally defined).
- Show documentation of any symbol (via hoogle), or open haddocks.
- Build project, run project.
- Auto-code formatting.
- Run a temporary web service for testing web apps.
- Deploy project to an Amazon instance.
It is built as a plugin to the Sublime text editor, so all the standard editing functionality is there. Here are the Haskell specific features:
- Syntax highlighting and error marking for Haskell and Cabal. Errors provided by interaction with the compiler. The errors are listed in an error pane, and the user can navigate through the errors.
- When working on a project that has a Cabal file, the Cabal file is detected, and the project can be configured, built, run, and tested using Cabal. The Cabal file is automatically detected. This also enhances error reporting, and auto-completion (all exported symbols from the project can then be matched against). Thus, there is good project management support.
- Rescan/build on file change.
- Can use Cabal-dev for sandboxing/pristine builds.
- Prettification/indentation and alignment via Stylish-Haskell.
- Jump to definition, and show information for a definition (using haskell-docs).
- Type display and insertion
- Fast building and type-inference via hdevtools.
- HLint provided by GHC-Mod.
Thus, Sublime-Haskell satisfies all the requirements listed at the top of the wiki for a baseline Haskell IDE. Sublime-Text is closed source, but the Haskell plugin is open source.
4 See also
- Results from the State of Haskell, 2011 Survey.
- Categorized Weaknesses from the State of Haskell 2011 Survey, which barely touched upon IDEs.
- Applications and libraries/Program development#Editor support
- Shim; the aim of the shim (Superior Haskell Interaction Mode) project is to provide better support for editing Haskell code in VIM and Emacs
5 Other IDEs and Editors
The list below is incomplete. Please add to it with whatever you think of. This list should be expanded into sections, as above, with more details, with links to the actual documentation of the described features.
- Vim — PROS: Free. Works on Windows. Works in terminal. Decent alignment support. Tag-based completion and jumps. Very good syntax highlighting, flymake (via Syntastic), Cabal integration, Hoogle. Documentation for symbol at point CONS: Arcane, difficult for new users. Some complain of bad indentation support.
- Emacs— PROS: Free. Works on Windows. Works in terminal. Decent alignment, indentation, syntax highlighting. Limited type information (type and info of name at point). Cabal/GHC/GHCi awareness and Haskell-aware REPL. Completion and jump-to-definition (via ETAGS). Documentation of symbol at point. Hoogle. Documentation for symbol at point. Flymake (error checking on the fly). CONS: Arcane, difficult for new users.
- Sublime — PROS: Works on Windows. CONS: Poor alignment support (though there are packages to do indentation a little better). Proprietary.
- Yi — PROS: Written in Haskell. Works in terminal. CONS: Very immature, lacking features. Problems building generally, especially on Windows.
- Leksah — PROS: Syntax highlighting. Understands Cabal, Module browser, dependency knowledge, documentation display inside the IDE, jump-to-definition, flymake (error checking on the fly), limited evaluation of snippets, scratch buffer. Autocompletion. Not an arcane interface a la Emacs/Vim. CONS: Doesn't have a decent REPL. Are there any other cons? — This should be moved to the section above.
- [[Editors | Other Editors]
- HEAT: An Interactive Development Environment for Learning & Teaching Haskell
- Geany PROS: Free. Works on Windows. Syntax highlighting, REPL. CONS: After using it for a while, Geany freezes quite often.
- plugin for Xcode (links to the web archive)
- hIDE is a GUI-based Haskell IDE written using gtk+hs. It does not include an editor but instead interfaces with NEdit, vim or GNU emacs.
- Through the dark ages many a programmer has longed for the ultimate tool. In response to this most unnerving craving, of which we ourselves have had maybe more than our fair share, the dynamic trio of #Haskellaniacs (dons, dcoutts and Lemmih) hereby announce, to the relief of the community, that a fetus has been conceived: hIDE - the Haskell Integrated Development Environment. So far the unborn integrates source code recognition and a chameleon editor, resenting these in a snappy gtk2 environment. Although no seer has yet predicted the date of birth of our hIDEous creature, we hope that the mere knowledge of its existence will spread peace of mind throughout the community as oil on troubled waters. See also: HIDE/Screenshots of HIDE and HIDE
- N.B. The link above is to the Wayback Machine (Web Archive); it seem that JCreator is no longer supported.
- JCreator is a highly customizable Java IDE for Windows. Features include extensive project support, fully customizable toolbars (including the images of user tools) and menus, increase/decrease indent for a selected block of text (tab/shift+tab respectively). The Haskell support module adds syntax highlighting for Haskell files and WinHugs, hugs, a static checker (if you double click on the error message, JCreator will jump to the right file and line and highlight it yellow) and the Haskell 98 Report as tools. Platforms: Win95, Win98, WinNT and Win2000 (only Win95 not tested yet). Size: 6MB. JCreator is a trademark of Xinox Software; Copyright © 2000 Xinox Software. The Haskell support module is made by Rijk-Jan van Haaften.
6.4 haste - Haskell TurboEdit
- haste - Haskell TurboEdit - was an IDE for the functional programming language Haskell, written in Haskell.
6.5 Visual Haskell
- Visual Haskell is a complete development environment for Haskell software, based on Microsoft's Microsoft Visual Studio platform. Visual Haskell integrates with the Visual Studio editor to provide interactive features to aid Haskell development, and it enables the construction of projects consisting of multiple Haskell modules, using the Cabal building/packaging infrastructure.
- Vital is a visual programming environment. It is particularly intended for supporting the open-ended, incremental style of development often preferred by end users (engineers, scientists, analysts, etc.).
- Pivotal 0.025 is an early prototype of a Vital-like environment for Haskell. Unlike Vital, however, Pivotal is implemented entirely in Haskell. The implementation is based on the use of the hs-plugins library to allow dynamic compilation and evaluation of Haskell expressions together with the gtk2hs library for implementing the GUI.