emacs-lsp/lsp-haskell@17d7d4c -> emacs-lsp/lsp-haskell@a56667b haskell/haskell-mode@41683c0 -> haskell/haskell-mode@e726776 jyp/attrap@4cf3e4a -> jyp/attrap@9c88154 jyp/dante@c516bc9 -> jyp/dante@e2acbf6 Switch to haskell-language-server, see https://neilmitchell.blogspot.com/2020/09/dont-use-ghcide-anymore-directly.html
4.6 KiB
lang/haskell
Table of Contents TOC
Description
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
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
+danteEnables dante; a fork of intero aimed at lightweightedness. It doesn't depend onstack, supports bothcabal-only andstackprojects, but lacks eldoc support.+ghcideEnables LSP support with ghcide (requires the:tools lspmodule).+lspEnables LSP support with haskell-language-server (requires the:tools lspmodule).
Plugins
- haskell-mode
-
+dante -
+lsp
Prerequisites
Depending on whether you use Dante, haskell-language-server or ghcide, your dependencies will differ:
- Dante users need
cabal,ghcandghc-mod - LSP users need the
haskell-language-serverLSP server ORghcide - All users will need the
hooglepackage
Cabal
To use Dante, you need cabal (the haskell package builder) and ghci (the
compiler, syntax checker & repl):
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
LSP (ghcide)
See https://github.com/digital-asset/ghcide for install instructions.
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:
-
(Dante users)
ghc-modstack install ghc-mod # or cabal install ghc-mod -
hooglecabal 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-configfile in your project may cause ghc-mod to not work.