A Sublime Text 2/3 plugin for Haskell. Features cabal building, error and warning highlighting, smart completion and ghc-mod integration.
Python Haskell
Latest commit 7f75518 Feb 22, 2017 B. Scott Michel fix typos.
Sorry. Mea maxima culpa. Didn't notice syntax and name issues in
fix_syntax.py. Fixed and tested.
Failed to load latest commit information.
Commands Added hover gifs Sep 24, 2016
Completions Restructured a bit. Nov 20, 2013
Icons ERRORS storage rewritten, now can autofix by hovering hint Sep 24, 2016
Keymaps Commands moved to commands module Jul 9, 2016
Menus Allow go to hackage from context menu on source file Jan 19, 2015
Messages Added Hover.gif, version 1.0.3 Jul 11, 2016
Settings use_improved_syntax setting Feb 22, 2017
Snippets Added OPTIONS_GHC snippet Oct 7, 2016
Syntaxes stability and issue fixes Feb 22, 2017
Themes Syntax fixes: Dec 11, 2016
.gitignore Showing messages with show_sublime_message_process Feb 11, 2013
.hgignore Ignore Sublime files. Apr 5, 2012
.no-sublime-package Unzip this package Aug 25, 2013
LICENSE.txt Renamed the license file, which was inexplicably called README. Mar 3, 2012
Makefile Add Makefile with check target to be run before commits Jan 12, 2013
README.md Merge branch 'master' of http://github.com/SublimeHaskell/SublimeHaskell Sep 30, 2016
autobuild.py Fixed flycheck: wait for idle, comparing last modified time Sep 24, 2016
autocomplete.py ensure stdout and stderr go somewhere. Feb 17, 2017
build.py Fixed cabal run (#301) Feb 21, 2017
cabal.py Commands moved to commands module Jul 9, 2016
check_lint.py Update output panel on no errors/warnings Oct 3, 2016
commands.py ensure stdout and stderr go somewhere. Feb 17, 2017
dependencies.json stability and issue fixes Feb 22, 2017
fix_syntax.py fix typos. Feb 22, 2017
hdevtools.py merge origin/master Feb 22, 2017
hsdev.py merge origin/master Feb 22, 2017
index.html Create index.html Feb 17, 2017
info_popup.py Fixed region update. Fixed showing empty popup on hover gutter. Oct 3, 2016
messages.json Added Hover.gif, version 1.0.3 Jul 11, 2016
parseoutput.py merge origin/master Feb 22, 2017
repl.py Commands moved to commands module Jul 9, 2016
stylishhaskell.py stability and issue fixes Feb 22, 2017
sublime_haskell_common.py use_improved_syntax setting Feb 22, 2017
symbols.py Fixed region update. Fixed showing empty popup on hover gutter. Oct 3, 2016
types.py Show unicode operators in 'expand to expression' panel Sep 27, 2016
worker.py Fixed worker: restart if crashed Sep 24, 2016



Package Control Join the chat at https://gitter.im/SublimeHaskell/SublimeHaskell PayPal Flattr this git repo




  • ghc and a recent Haskell Platform (>= 2012 should do fine)
  • cabal
  • hsdev cabal package (cabal install hsdev) for inspection, enhanced completion, goto, symbol info etc.

Not necessary, but useful:


  • ghc-mod (for import and LANGUAGE completions and type inference, cabal install ghc-mod, not used if hsdev enabled, ghc-mod is used by hsdev as a library)
  • hdevtools (or fork for windows) (for type inference, cabal install hdevtools, not used if hsdev enabled)


  • If your cabal, ghc-mod, ghc etc. are not installed in a system PATH, you have to adjust SublimeHaskell's add_to_PATH setting.

There are also special theme with enhanced haskell entities and marks (errors, warnings and hints) coloring
Note different coloring for types and constructors (in import list, data declaration etc.), special coloring of generic variables in types, pragmas and module imports



  1. Get Sublime Text 2/3: http://www.sublimetext.com/
  2. Install the Sublime Package Control package: http://wbond.net/sublime_packages/package_control/installation
  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, automatic error highlighting and enhanced auto-completion is 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 on change. Any symbols that they export are provided in the auto-complete suggestions.

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

Use f12 to go to declaration and ctrl+k ctrl+i to show symbol info with documentation. These command are also available through context menu with right-click.

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 alt+d alt+e and alt+shift+d alt+shift+e. To show hidden error output, use command Show error panel (ctrl-alt-e)

Stack support

Build commands such as Build, Clean, Install, Rebuild uses stack if there is stack.yaml near .cabal. If you don't want to use stack, set haskell_build_tool setting to cabal.

hsdev uses stack to build dependencies and to get corresponding package-dbs. Since it passes --compiler and --arch options to stack to get package-dbs built with hsdev-compatible compiler.

Enhanced completion

Works in export list (showing symbols in scope), import list, expressions. Completes after module qualifier (several modules can be import qualified as with same qualifier). Takes into account module reexports for sources. Autocompletion


Show popup with symbol info and with error/warning/hint details. Requires SublimeText 3 dev build > 3116 (https://forum.sublimetext.com/t/dev-build-3116/21148). Hover

It also shows inferred type when possible HoverTypes

And you can autofix warnings/hints on popup for warnings/hints AutoFixHover


  • SublimeHaskell: Insert import for symbol — add import for declaration InsertImport
  • SublimeHaskell: Find declarations — find declarations in installed packages and in projects
  • SublimeHaskell: Search declarations everywhere — search declarations in hayoo too
  • SublimeHaskell: Browse module — get declarations for module BrowseModule
  • SublimeHaskell: Browse declarations — get declarations in scope of current file
  • SublimeHaskell: Show symbol info — get help for symbol, ctrl+k ctrl+i
  • SublimeHaskell: Toggle symbol info panel — toggle continuout symbol info panel, which show info about symbol under cursor. Useful when reading code. SymbolInfo
  • SublimeHaskell: Go to module — go to module, ctrl+k ctrl+p GoToModule
  • SublimeHaskell: Go to declaration — overrides default, f12
  • Ctrl+R, Ctrl+Shift+R — overrides default, goto symbol and goto symbol in project
  • SublimeHaskell: Show type — show type/types for current expression, ctrl-k ctrl-h ctrl-t
  • SublimeHaskell: Expand selection to Expression — expand selection to expression, ctrl+shift+y
  • SublimeHaskell: Show/hide all types — get all types and highlight while selection modifies, ctrl+t, h Types
  • SublimeHaskell: Insert type — insert type for selected expression, ctrl-k ctrl-h ctrl-i
  • SublimeHaskell: Hayoo — search in hayoo
  • SublimeHaskell: Auto fix — auto fix some of warnings and/or errors (for now redundant imports and hlint hints) AutoFix
  • SublimeHaskell: Stylish — stylish source with stylish-haskell
  • SublimeHaskell: Scan docs and infer types — as long as scanning docs for sources and inferring types is long process, it's disabled by default, but this command can be used to scan docs and infer types for currently opened view
  • SublimeHaskell: Check & Lint — check/lint/check & lint opened file. Enable option check_lint_fly to check & lint on idle, rescanning actual source, so that completions are updated
  • Eval commands — see animation
    • SublimeHaskell: Eval selection — eval selected expression, for example
      • [1..10][1,2,3,4,5,6,7,8,9,10]
      • replicate 10 'a'aaaaaaaaaa (note no double quotes for string result)
    • SublimeHaskell: Apply to selection — same as above, but applies function to each selection
      • foobarreverseraboof
      • [1..10]reverse[10,9,8,7,6,5,4,3,2,1]
      • 1, 2, 3succ2, 3, 4
      • [1..3]intercalate ", " . map (\i -> "foo" ++ show i)foo1, foo2, foo3
    • SublimeHaskell: Apply to selection list — applies function to list made from selections
      • foo, bar, bazreversebaz, bar, foo
      • foo, bar, bazsortbar, baz, foo
  • Repl commands (uses SublimeREPL package)
    • SublimeHaskell Repl: GHCi — runs ghci
    • SublimeHaskell Repl: GHCi current file — runs ghci and loads current file
    • SublimeHaskell Repl: Cabal Repl — runs cabal repl for current project
    • SublimeHaskell Repl: Load — loads current file or project in repl
  • Context menu commands
    • Open package on Hackage — works within symbol info panel, opens Hackage page
    • Open module on Hackage — words in symbol info panel and in sources, opens Hackage page for selected module
  • Build commands
    • Build, Typecheck build (no codegen), Clean, Configure, Rebuild, Install, Test, Run
  • Error commands:
    • SublimeHaskell: Go to next error — go to next error in file, alt+d alt+e
    • SublimeHaskell: Go to previous error — go to previous error in file, alt+shift+d alt+shift+e
    • SublimeHaskell: Show error panel — show error panel if it was hidden, 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"} }

Using other useful projects with SublimeText


There are two kinds of jump-to-definition: Inside your project and outside your project. In any case, install the Sublime CTags package via Package Control, and cabal install hasktags.

CTags expects the extended exuberant ctags format.

Inside your project: hasktags

  • In your project, hasktags --ctags --extendedctag .
  • You can now jump to definitions inside your project (Ctrl-T, Ctrl-T is the default keybinding)

Inside and outside your project: codex

codex allows you to use ctags to jump to definitions that are declared in your cabal dependencies.

  • cabal install codex
  • Run codex set format sublime, that updates your ~/.codex file to Sublime's Ctags plugin's format
  • Change ~/.codex to tagsFileName: .tags
  • In your project, codex cache clean && codex update
  • You can now jump to the source code of definitions outside of your project.
  • The commands CTags: Show Symbols and CTags: Rebuild Tags currently don't work with codex


Icons from FlatIcon.

Error icon by Eleonor Wang
Warning icon by Freepik
Hint icon by Gregor Cresnar Wrench icon by Gregor Cresnar