Skip to content
This repository

A Sublime Text 2/3 plugin for Haskell. Features cabal building, error and warning highlighting, smart completion and ghc-mod integration.

Revert "autobuild: Guard against view.window() being None. Affects #140"

This reverts commit bb3c19a.

This was not a fix.
It looks like view.window() is None for *both* my windows.
latest commit 0c73fc80a9
Niklas Hambüchen nh2 authored April 24, 2014
Octocat-spinner-32 Commands Restructured a bit. November 20, 2013
Octocat-spinner-32 Completions Restructured a bit. November 20, 2013
Octocat-spinner-32 Keymaps Restructured a bit. November 20, 2013
Octocat-spinner-32 Menus Restructured a bit. November 20, 2013
Octocat-spinner-32 Settings Restructured a bit. November 20, 2013
Octocat-spinner-32 Snippets Converted snippets to tabs. November 20, 2013
Octocat-spinner-32 Syntaxes Restructured a bit. November 20, 2013
Octocat-spinner-32 .gitignore Showing messages with show_sublime_message_process February 11, 2013
Octocat-spinner-32 .hgignore Ignore Sublime files. April 04, 2012
Octocat-spinner-32 .no-sublime-package Unzip this package August 25, 2013
Octocat-spinner-32 CabalInspector.hs CabalInspector: collect info about tests March 30, 2013
Octocat-spinner-32 Cubicle.tmTheme Leave theme in the toplevel. November 20, 2013
Octocat-spinner-32 LICENSE.txt Renamed the license file, which was inexplicably called README. March 02, 2012
Octocat-spinner-32 Makefile Add Makefile with check target to be run before commits January 12, 2013
Octocat-spinner-32 ModuleInspector.hs Ignore docs for pictures (fixes build with haddock 2.14) April 19, 2014
Octocat-spinner-32 README: Mention problem with too new haddock April 03, 2014
Octocat-spinner-32 TODO.txt Fixed TODO, removed logs October 16, 2012
Octocat-spinner-32 Don't build with ghc_mod when enable_ghc_mod setting is false March 29, 2013
Octocat-spinner-32 Fixing #128: python 3 no longer has builtin 'unicode' December 25, 2013
Octocat-spinner-32 Fixed #110 October 11, 2013
Octocat-spinner-32 New setting 'cache_path' to override the default path used for the Ca… July 28, 2013
Octocat-spinner-32 Forgot the comment. November 20, 2013
Octocat-spinner-32 Fixed browse module for module in sources, catching OSError in hdevto… March 28, 2013
Octocat-spinner-32 Don't attempt to check & lint Cabal files. August 24, 2013
Octocat-spinner-32 Migrated to Sublime Text 3 March 02, 2013
Octocat-spinner-32 README: described hotkeys for next/prev errors; Fixed insert type com… April 13, 2013
Octocat-spinner-32 Fix some whitespace August 24, 2013
Octocat-spinner-32 Checking if hdevtools enabled March 29, 2013
Octocat-spinner-32 Slightly improve output panel spacing August 24, 2013
Octocat-spinner-32 fixed a typo in error message October 16, 2013
Octocat-spinner-32 Fixing #128: python 3 no longer has builtin 'unicode' December 25, 2013
Octocat-spinner-32 Don't inspect modules if they haven't been changed since last time June 12, 2013
Octocat-spinner-32 Go to declaration: allow qualified decl in current module March 29, 2013




  • ghc and a recent Haskell Platform (>= 2012 should do fine)
  • cabal
  • Cabal packages: base, bytestring, aeson, haskell-src-exts (== 1.14.*), haddock (cabal install aeson haskell-src-exts haddock)
  • If you are using GHC 7.6, you might have trouble with too new versions of haddock; in that case, try cabal install haddock --constraint=haddock==

Optional, but useful:

  • ghc-mod (for import and LANGUAGE completions and type inference, cabal install ghc-mod)
  • stylish-haskell (for code prettification, cabal install stylish-haskell)
  • cabal-dev if you want to use it
  • haskell-docs (for documentation in 'Symbol info' command, cabal install haskell-docs)
  • hdevtools (or fork for windows) (for type inference, cabal install hdevtools)


  1. Get Sublime Text 2:
  2. Install the Sublime Package Control package:
  3. Use Package Control to install this package (SublimeHaskell)


In short: Press Shift-Ctrl-P and type haskell to explore all commands.

When editing Haskell source files that are part of a Cabal project, automatic error highlighting and enhanced auto-completion are available.

Each time you save, any errors in your program will be listed at the bottom of the window and highlighted in the source code.

All source files in the project are scanned when the change. Any symbols that they export are provided in the auto-complete suggestions.

To use cabal-dev instead of cabal, set use_cabal_dev to true (or use command "Switch Cabal/Cabal-Dev") and specify cabal-dev absolute path. Completion list will be rescanned and build will use cabal-dev.

Stylish-haskell can be used to stylish file or selected text.

Use Ctrl-Shift-R to go to declaration and Ctrl-K-I to show symbol info with documentation. These command are also available through context menu with right-click.

Command 'SublimeHaskell: Browse module' is similar to ghci's browse command

To show inferred types use Show type (ctrl-k ctrl-h ctrl-t) command.

To insert inferred type use Insert type (ctrl-k ctrl-h ctrl-i).

You can jump between the errors and warnings with F4 and Shift-F4. To show hidden error output, use command Show error panel (ctrl-alt-e)

Build Systems

You don't have to use SublimeHaskell's built-in build functionality.

If you prefer, you can disable them in the settings, and use plain Sublime Build Systems:


Save this to your ~/.config/sublime-text-2/Packages/User/cabal-custom.sublime-build to make a custom cabal build system:

  "cmd": ["cabal build --ghc-options='-O0 -hidir o0 -odir o0'"],  // append lib:myPackage or myexecutable here to only build certain cabal targets
  "shell": true,
  "file_regex": "^(\\S*?):(\\d+):(\\d+):$"  // this matches the output of ghc

For more options, look here.


Save this to your ~/.config/sublime-text-2/Packages/User/hdevtools.sublime-build to make hdevtools a build system:

  "cmd": ["/home/USERNAME/.cabal/bin/hdevtools", "check", "-g", "-Wall", "$file"],
  "file_regex": "^(.*?):(\\d+):(\\d+):",
  "selector": "source.haskell"

Using build system results

You can then build with Ctrl-B and jump between the errors with (Shift-)F4.

It is also useful to add this to your key bindings to redisplay the error panel at any time:

  { "keys": ["ctrl+alt+b"], "command": "show_panel", "args": {"panel": "output.exec"} }

If the ModuleInspector takes too much time

The ModuleInspector is a program that looks at your Haskell environment to provide auto completion.

Depending on your environment, this may takes very long.

You can disable it with the "inspect_modules": false setting.

Something went wrong with that request. Please try again.