A Sublime Text 3 plugin for Haskell. Features cabal building, error and warning highlighting, smart completion and ghc-mod integration.
- Total 47K
- Win 17K
- OS X 17K
- Linux 13K
|Dec 14||Dec 13||Dec 12||Dec 11||Dec 10||Dec 9||Dec 8||Dec 7||Dec 6||Dec 5||Dec 4||Dec 3||Dec 2||Dec 1||Nov 30||Nov 29||Nov 28||Nov 27||Nov 26||Nov 25||Nov 24||Nov 23||Nov 22||Nov 21||Nov 20||Nov 19||Nov 18||Nov 17||Nov 16||Nov 15||Nov 14||Nov 13||Nov 12||Nov 11||Nov 10||Nov 9||Nov 8||Nov 7||Nov 6||Nov 5||Nov 4||Nov 3||Nov 2||Nov 1||Oct 31||Oct 30|
Quick link ==> SublimeHaskell's Documentation
Required (Before You Install SublimeHaskell)
You will need to install either the GHC Haskell compiler and
stack build tool and a backend before you install SublimeHaskell.
stackwill install ghc automatically, so there's no need to install GHC independently:
- or you may install Haskell Platform (includes
- The Glorious Haskell Computer (ghc). Preferably, you should install the Haskell Platform if you don't already have a Haskell development and hacking environment set up.
- cabal. Under normal circumstances,
cabalshould come pre-installed with your Haskell environment, e.g., if you installed the Haskell Platform.
A backend. SublimeHaskell communicates with the backend to support the interesting editing features. The preferred backend is
hsdev. You can use one of the deprecated backends, but know that support for these backends may be dropped or removed in a future SublimeHaskell release.
hsdev cabal package for inspection, enhanced completion, goto, symbol info etc.
cabal install hsdev
stack— create config (for example,
hsdev.yaml) with contents:
packages:  resolver: lts-13.29 extra-deps: - hsdev-0.3.3.1 - haddock-api-2.21.0 - hdocs-0.5.3.1 - network-220.127.116.11
And then run
stack install hsdev --stack-yaml hsdev.yaml
ghc-mod (for import and LANGUAGE completions and type inference,
cabal install ghc-mod, not used if
ghc-modis used by
hsdevas a library)
- Get Sublime Text: http://www.sublimetext.com/
- Install the Sublime Package Control package: http://wbond.net/sublime_packages/package_control/installation
- Use Package Control to install SublimeHaskell
Open a Haskell source file,
cabal builder file or a
stack.yaml builder and have a productive Haskell development session!
- stack. The Haskell Tool Stack. If you installed the Haskell Platform, you already have this installed.
stackis a companion Haskell build tool that supplements
- SublimeREPL package for REPL support, if you want to interact with GHCI from within SublimeText.
- Code prettifier:
Tool Installation Location
ghc, etc.) are usually installed in a directory that is already added to your
PATH environment variable. SublimeHaskell will also look for these tools in several “Haskell standard” places. These places include:
More advanced users can configure
cabal's user and global install paths in
$HOME/.cabal/config. SublimeHaskell will use these values if configured and if the directories to which they refer exist.
If you have a non-standard installation location for your tools, you can configure this in SublimeHaskell's “User Settings” by adjusting
add_to_PATH. You will have to restart SublimeText after you save your preferences.
There is a 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
Open the SublimeText Command Palette (
Option-Command-Pon OS X) and type
haskellto explore SublimeHaskell's goodness.
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.
F12to go to declaration and
ctrl+k ctrl+ito show symbol info with documentation. These commands are also available through context menu with right-click.
To show inferred types use
ctrl-k ctrl-h ctrl-t) command.
To insert inferred type use
ctrl-k ctrl-h ctrl-i).
You can jump between the errors and warnings with
To show hidden error output, use command
Show error panel(
Features and SublimeHaskell Goodness
Build commands such as
stack if there is
.cabal. If you don't want to use
haskell_build_tool setting to
stack to build dependencies and to get corresponding package-dbs. Since
0.1.7.2 it passes
--arch options to
stack to get package-dbs built with
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.
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).
It also shows inferred type when possible
You can select all usages of symbol via link
And you can autofix warnings/hints on popup for warnings/hints
SublimeHaskell: Insert import for symbol— add import for declaration
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
SublimeHaskell: Browse declarations— get declarations in scope of current file
SublimeHaskell: Show symbol info— get help for symbol,
SublimeHaskell: Toggle symbol info panel— toggle continuout symbol info panel, which show info about symbol under cursor. Useful when reading code.
SublimeHaskell: Go to module— go to module,
SublimeHaskell: Go to declaration— overrides default,
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,
SublimeHaskell: Show/hide all types— get all types and highlight while selection modifies,
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)
SublimeHaskell: Stylish— stylish source with
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_flyto check & lint on idle, rescanning actual source, so that completions are updated
SublimeHaskell: Eval expression— evaluate expression in context of current module
SublimeHaskell: Expression type— evaluate expression type in context of current module
- Eval commands — see animation
SublimeHaskell: Eval selection— eval selected expression, for example
replicate 10 'a'⤇
aaaaaaaaaa(note no double quotes for string result)
SublimeHaskell: Apply to selection— same as above, but applies function to each selection
intercalate ", " . map (\i -> "foo" ++ show i)⤇
foo1, foo2, foo3
SublimeHaskell: Apply to selection list— applies function to list made from selections
- Repl commands (uses SublimeREPL package)
SublimeHaskell Repl: GHCi— runs
SublimeHaskell Repl: GHCi current file— runs
ghciand loads current file
SublimeHaskell Repl: Cabal Repl— runs
cabal replfor 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
Show symbol usages— show list of locations where symbol is used
- Build commands
Typecheck build (no codegen),
- Error commands:
SublimeHaskell: Go to next error— go to next error in file,
SublimeHaskell: Go to previous error— go to previous error in file,
SublimeHaskell: Show error panel— show error panel if it was hidden,
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
codex set format sublime, that updates your
~/.codexfile to Sublime's Ctags plugin's format
- 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 Symbolsand
CTags: Rebuild Tagscurrently don't work with
Icons from FlatIcon.