This module adds Haskell support, powered by either dante (the default) or LSP (haskell-language-server or ghcide).
- Code completion (
company-ghc
) - Look up documentation (
hoogle
) - eldoc support (
dante
) - REPL (
ghci
) - Syntax-checking (
flycheck
) - Code navigation (
dante
) - Snippets
Here are a few resources I’ve found indispensable in my Haskell adventures:
- Learn you a haskell for great good
- Haskell Programming from first principles
- Awesome Haskell: an extensive list of haskell resources
- The Haskell Tool Stack docs
+dante
Enables dante; a fork of intero aimed at lightweightedness. It doesn’t depend onstack
, supports bothcabal
-only andstack
projects, but lacks eldoc support.+ghcide
Enables LSP support with ghcide (requires the:tools lsp
module).+lsp
Enables LSP support with haskell-language-server (requires the:tools lsp
module).
- haskell-mode
+dante
+lsp
Depending on whether you use Dante, haskell-language-server or ghcide, your dependencies will differ:
- Dante users need
cabal
,ghc
andghc-mod
- LSP users need the
haskell-language-server
LSP server ORghcide
- All users will need the
hoogle
package
To use Dante, you need cabal
(the haskell package builder) and ghci
(the
compiler, syntax checker & repl):
brew install cabal-install ghc
sudo pacman -S cabal-install ghc
sudo zypper install cabal-install ghc
You will need stack
and git
installed.
You will find a comprehensive instructions for haskell-language-server on its project page, but if you are using ghcup:
ghcup install hls
See https://github.com/digital-asset/ghcide for install instructions.
To use LSP, you need stack
:
brew install haskell-stack
stack setup
sudo pacman -S stack
# Replace pacaur with your AUR package manager of choice
pacaur -S ncurses5-compat-lib
stack setup
sudo zypper install stack
stack setup
You’ll need to install the following packages using stack
or cabal
:
- (Dante users)
ghc-mod
stack install ghc-mod # or cabal install ghc-mod
hoogle
cabal update cabal install happy haskell-src-exts # ghc-mod/hoogle dependencies cabal ghc-mod hoogle # or stack install ghc-mod stack install hoogle
And ensure the binaries for these packages are in your PATH
, e.g.
# place this in your profile file, like ~/.bash_profile or ~/.zshenv
export PATH="~/.local/bin:$PATH"
haskell-mode
will typically detect what REPL to run based on your project
(e.g. stack, (old-style) cabal or ghc). If you want the new-style cabal REPL you
must set haskell-process-type
manually:
(setq haskell-process-type 'cabal-new-repl)
- Stack users: a
dist/setup-config
file in your project may cause ghc-mod to not work.