BREAKING CHANGE: Now that haskell-language-server is mature there is little reason not to pick it over dante. |
||
---|---|---|
.. | ||
+lsp.el | ||
autoload.el | ||
config.el | ||
doctor.el | ||
packages.el | ||
README.org |
lang/haskell
Table of Contents TOC
Description
This module adds Haskell support, powered by LSP (haskell-language-server).
- Code completion (
company-ghc
) - Look up documentation (
hoogle
) - REPL (
ghci
) - Syntax-checking (
flycheck
) - Snippets
External resources
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
Module Flags
+lsp
Enables LSP support with haskell-language-server (requires the:tools lsp
module).
Plugins
- haskell-mode
-
+lsp
Prerequisites
- LSP users need the
haskell-language-server
LSP server - All users will need the
hoogle
package
Cabal
MacOS
brew install cabal-install ghc
Arch Linux
sudo pacman -S cabal-install ghc
openSUSE
sudo zypper install cabal-install ghc
LSP (haskell-language-server)
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
Stack
To use LSP, you need stack
:
MacOS
brew install haskell-stack
stack setup
Arch Linux
sudo pacman -S stack
# Replace pacaur with your AUR package manager of choice
pacaur -S ncurses5-compat-lib
stack setup
openSUSE
sudo zypper install stack
stack setup
Haskell packages
You'll need to install the following packages using stack
or cabal
:
-
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"
Configuration
Using the new-style cabal REPL
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)
Troubleshooting
- Stack users: a
dist/setup-config
file in your project may cause ghc-mod to not work.